aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml116
-rw-r--r--BUILD4
-rw-r--r--Makefile.am25
-rw-r--r--benchmarks/Makefile.am209
-rw-r--r--benchmarks/ProtoBench.java262
-rw-r--r--benchmarks/README.md41
-rw-r--r--benchmarks/benchmark_messages_proto2.proto143
-rw-r--r--benchmarks/cpp_benchmark.cc35
-rw-r--r--benchmarks/datasets/google_message1/benchmark_message1_proto2.proto78
-rw-r--r--benchmarks/datasets/google_message1/benchmark_message1_proto3.proto (renamed from benchmarks/benchmark_messages_proto3.proto)0
-rw-r--r--benchmarks/datasets/google_message1/dataset.google_message1_proto2.pb (renamed from benchmarks/google_message1.dat)bin228 -> 289 bytes
-rw-r--r--benchmarks/datasets/google_message1/dataset.google_message1_proto3.pbbin0 -> 289 bytes
-rw-r--r--benchmarks/datasets/google_message2/benchmark_message2.proto76
-rw-r--r--benchmarks/datasets/google_message2/dataset.google_message2.pb (renamed from benchmarks/google_message2.dat)bin84570 -> 84625 bytes
-rw-r--r--benchmarks/datasets/google_message3/benchmark_message3.proto533
-rw-r--r--benchmarks/datasets/google_message3/benchmark_message3_1.proto1279
-rw-r--r--benchmarks/datasets/google_message3/benchmark_message3_2.proto498
-rw-r--r--benchmarks/datasets/google_message3/benchmark_message3_3.proto465
-rw-r--r--benchmarks/datasets/google_message3/benchmark_message3_4.proto490
-rw-r--r--benchmarks/datasets/google_message3/benchmark_message3_5.proto472
-rw-r--r--benchmarks/datasets/google_message3/benchmark_message3_6.proto453
-rw-r--r--benchmarks/datasets/google_message3/benchmark_message3_7.proto55
-rw-r--r--benchmarks/datasets/google_message3/benchmark_message3_8.proto1899
-rw-r--r--benchmarks/datasets/google_message4/benchmark_message4.proto453
-rw-r--r--benchmarks/datasets/google_message4/benchmark_message4_1.proto473
-rw-r--r--benchmarks/datasets/google_message4/benchmark_message4_2.proto291
-rw-r--r--benchmarks/datasets/google_message4/benchmark_message4_3.proto750
-rwxr-xr-xbenchmarks/download_data.sh5
-rw-r--r--benchmarks/generate_datasets.cc117
-rw-r--r--benchmarks/readme.txt46
-rw-r--r--cmake/CMakeLists.txt7
-rw-r--r--cmake/extract_includes.bat.in1
-rw-r--r--cmake/install.cmake32
-rw-r--r--cmake/libprotobuf-lite.cmake2
-rw-r--r--configure.ac10
-rw-r--r--conformance/failure_list_cpp.txt1
-rw-r--r--conformance/failure_list_java.txt2
-rw-r--r--csharp/src/Google.Protobuf/WellKnownTypes/Any.cs21
-rw-r--r--csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs8
-rw-r--r--docs/third_party.md1
-rw-r--r--examples/WORKSPACE2
-rw-r--r--java/core/src/main/java/com/google/protobuf/Android.java (renamed from src/google/protobuf/unittest_import_public_proto3.proto)29
-rw-r--r--java/core/src/main/java/com/google/protobuf/ByteString.java10
-rw-r--r--java/core/src/main/java/com/google/protobuf/CodedInputStream.java104
-rw-r--r--java/core/src/main/java/com/google/protobuf/FieldSet.java5
-rw-r--r--java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java42
-rw-r--r--java/core/src/main/java/com/google/protobuf/TextFormat.java35
-rw-r--r--java/core/src/main/java/com/google/protobuf/UnsafeUtil.java44
-rw-r--r--java/core/src/main/java/com/google/protobuf/Utf8.java484
-rw-r--r--java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java12
-rw-r--r--java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java325
-rw-r--r--java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java20
-rw-r--r--java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java9
-rw-r--r--java/core/src/test/java/com/google/protobuf/TestUtil.java6
-rw-r--r--java/core/src/test/java/com/google/protobuf/TextFormatTest.java88
-rw-r--r--java/util/src/main/java/com/google/protobuf/util/JsonFormat.java57
-rw-r--r--java/util/src/main/java/com/google/protobuf/util/Timestamps.java11
-rw-r--r--java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java15
-rw-r--r--js/binary/arith.js2
-rw-r--r--js/binary/decoder.js10
-rw-r--r--js/binary/encoder.js4
-rw-r--r--js/binary/reader.js50
-rw-r--r--js/binary/utils.js8
-rw-r--r--js/binary/utils_test.js2
-rw-r--r--js/binary/writer.js106
-rw-r--r--js/commonjs/export_testdeps.js1
-rw-r--r--js/debug.js9
-rw-r--r--js/debug_test.js11
-rw-r--r--js/message.js64
-rw-r--r--js/message_test.js11
-rw-r--r--kokoro/linux/32-bit/Dockerfile143
-rwxr-xr-xkokoro/linux/32-bit/build.sh17
-rw-r--r--kokoro/linux/32-bit/continuous.cfg11
-rw-r--r--kokoro/linux/32-bit/presubmit.cfg11
-rw-r--r--kokoro/linux/64-bit/Dockerfile244
-rwxr-xr-xkokoro/linux/64-bit/build.sh17
-rw-r--r--kokoro/linux/64-bit/continuous.cfg11
-rw-r--r--kokoro/linux/64-bit/presubmit.cfg11
-rwxr-xr-xkokoro/linux/build_and_run_docker.sh60
-rwxr-xr-xkokoro/linux/golang/build.sh17
-rw-r--r--kokoro/linux/golang/continuous.cfg11
-rw-r--r--kokoro/linux/golang/presubmit.cfg11
-rwxr-xr-xkokoro/linux/java_jdk7/build.sh17
-rw-r--r--kokoro/linux/java_jdk7/continuous.cfg11
-rw-r--r--kokoro/linux/java_jdk7/presubmit.cfg11
-rwxr-xr-xkokoro/linux/java_oracle7/build.sh17
-rw-r--r--kokoro/linux/java_oracle7/continuous.cfg11
-rw-r--r--kokoro/linux/java_oracle7/presubmit.cfg11
-rwxr-xr-xkokoro/linux/javanano_jdk7/build.sh17
-rw-r--r--kokoro/linux/javanano_jdk7/continuous.cfg11
-rw-r--r--kokoro/linux/javanano_jdk7/presubmit.cfg11
-rwxr-xr-xkokoro/linux/javanano_oracle7/build.sh17
-rw-r--r--kokoro/linux/javanano_oracle7/continuous.cfg11
-rw-r--r--kokoro/linux/javanano_oracle7/presubmit.cfg11
-rwxr-xr-xkokoro/linux/javascript/build.sh17
-rw-r--r--kokoro/linux/javascript/continuous.cfg11
-rw-r--r--kokoro/linux/javascript/presubmit.cfg11
-rw-r--r--kokoro/linux/make_test_output.py94
-rwxr-xr-xkokoro/linux/php_all/build.sh17
-rw-r--r--kokoro/linux/php_all/continuous.cfg11
-rw-r--r--kokoro/linux/php_all/presubmit.cfg11
-rwxr-xr-xkokoro/linux/pull_request_in_docker.sh66
-rwxr-xr-xkokoro/linux/python/build.sh17
-rw-r--r--kokoro/linux/python/continuous.cfg11
-rw-r--r--kokoro/linux/python/presubmit.cfg11
-rwxr-xr-xkokoro/linux/python_cpp/build.sh17
-rw-r--r--kokoro/linux/python_cpp/continuous.cfg11
-rw-r--r--kokoro/linux/python_cpp/presubmit.cfg11
-rwxr-xr-xkokoro/linux/ruby_all/build.sh17
-rw-r--r--kokoro/linux/ruby_all/continuous.cfg11
-rw-r--r--kokoro/linux/ruby_all/presubmit.cfg11
-rwxr-xr-xobjectivec/DevTools/full_mac_build.sh26
-rwxr-xr-xobjectivec/DevTools/pddm_tests.py6
-rw-r--r--objectivec/GPBCodedOutputStream.m2
-rw-r--r--objectivec/GPBDictionary.h2800
-rw-r--r--objectivec/GPBDictionary.m1953
-rw-r--r--objectivec/GPBMessage.m20
-rw-r--r--objectivec/GPBRootObject.m8
-rw-r--r--objectivec/GPBUtilities.m305
-rw-r--r--objectivec/GPBUtilities_PackagePrivate.h3
-rw-r--r--objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj2
-rw-r--r--objectivec/Tests/GPBCodedInputStreamTests.m2
-rw-r--r--objectivec/Tests/GPBDictionaryTests+Bool.m80
-rw-r--r--objectivec/Tests/GPBDictionaryTests+Int32.m105
-rw-r--r--objectivec/Tests/GPBDictionaryTests+Int64.m105
-rw-r--r--objectivec/Tests/GPBDictionaryTests+String.m95
-rw-r--r--objectivec/Tests/GPBDictionaryTests+UInt32.m105
-rw-r--r--objectivec/Tests/GPBDictionaryTests+UInt64.m105
-rw-r--r--objectivec/Tests/GPBDictionaryTests.pddm35
-rw-r--r--objectivec/Tests/GPBMessageTests+Serialization.m8
-rw-r--r--objectivec/Tests/GPBMessageTests.m6
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json80
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_1024.pngbin0 -> 205605 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_120.pngbin0 -> 7233 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_152.pngbin0 -> 10332 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_167.pngbin0 -> 11694 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_180.pngbin0 -> 13111 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_20.pngbin0 -> 752 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_29.pngbin0 -> 1197 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_40.pngbin0 -> 1730 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_58.pngbin0 -> 2748 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_60.pngbin0 -> 2834 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_76.pngbin0 -> 3931 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_80.pngbin0 -> 4125 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_87.pngbin0 -> 4671 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.pngbin8583 -> 0 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6_2x.pngbin17744 -> 0 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.pngbin8969 -> 0 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7_2x.pngbin18788 -> 0 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.pngbin7021 -> 0 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6_2x.pngbin13348 -> 0 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_2x.pngbin11128 -> 0 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_3x.pngbin21792 -> 0 bytes
-rw-r--r--objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json25
-rw-r--r--objectivec/google/protobuf/Any.pbobjc.h21
-rw-r--r--objectivec/google/protobuf/Timestamp.pbobjc.h8
-rw-r--r--php/README.md2
-rw-r--r--protobuf.bzl12
-rw-r--r--protoc-artifacts/README.md5
-rw-r--r--python/MANIFEST.in3
-rwxr-xr-xpython/google/protobuf/descriptor.py4
-rw-r--r--python/google/protobuf/descriptor_database.py26
-rw-r--r--python/google/protobuf/descriptor_pool.py32
-rwxr-xr-xpython/google/protobuf/internal/containers.py4
-rw-r--r--python/google/protobuf/internal/descriptor_database_test.py21
-rw-r--r--python/google/protobuf/internal/descriptor_pool_test.py56
-rwxr-xr-xpython/google/protobuf/internal/descriptor_test.py13
-rwxr-xr-xpython/google/protobuf/internal/encoder.py3
-rwxr-xr-xpython/google/protobuf/internal/message_test.py16
-rwxr-xr-xpython/google/protobuf/internal/text_format_test.py7
-rw-r--r--python/google/protobuf/internal/well_known_types_test.py2
-rw-r--r--python/google/protobuf/pyext/descriptor_containers.cc530
-rw-r--r--python/google/protobuf/pyext/message.cc90
-rw-r--r--python/google/protobuf/pyext/message.h12
-rwxr-xr-xpython/google/protobuf/text_format.py2
-rw-r--r--ruby/README.md4
-rw-r--r--ruby/ext/google/protobuf_c/storage.c16
-rw-r--r--ruby/tests/repeated_field_test.rb6
-rw-r--r--src/Makefile.am5
-rw-r--r--src/google/protobuf/any.pb.cc14
-rw-r--r--src/google/protobuf/any.pb.h19
-rw-r--r--src/google/protobuf/any.proto21
-rw-r--r--src/google/protobuf/api.pb.cc76
-rw-r--r--src/google/protobuf/api.pb.h120
-rwxr-xr-xsrc/google/protobuf/arena.cc371
-rw-r--r--src/google/protobuf/arena.h83
-rw-r--r--src/google/protobuf/arena_impl.h158
-rw-r--r--src/google/protobuf/arena_unittest.cc32
-rwxr-xr-xsrc/google/protobuf/arenastring.h21
-rw-r--r--src/google/protobuf/compiler/annotation_test_util.cc26
-rw-r--r--src/google/protobuf/compiler/annotation_test_util.h17
-rw-r--r--src/google/protobuf/compiler/code_generator.h2
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_enum_field.cc6
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_field.cc17
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_field.h4
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_file.cc101
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_generator.cc39
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_helpers.cc2
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_helpers.h4
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_message.cc769
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_message.h3
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_message_field.cc601
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_message_field.h9
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_options.h2
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_primitive_field.cc8
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_string_field.cc106
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_string_field.h2
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_unittest.cc45
-rw-r--r--src/google/protobuf/compiler/cpp/metadata_test.cc4
-rw-r--r--src/google/protobuf/compiler/java/java_enum_field.cc10
-rw-r--r--src/google/protobuf/compiler/java/java_message.cc37
-rw-r--r--src/google/protobuf/compiler/java/java_message_lite.cc62
-rwxr-xr-xsrc/google/protobuf/compiler/js/js_generator.cc35
-rw-r--r--src/google/protobuf/compiler/mock_code_generator.cc2
-rw-r--r--src/google/protobuf/compiler/plugin.pb.cc82
-rw-r--r--src/google/protobuf/compiler/plugin.pb.h89
-rw-r--r--src/google/protobuf/descriptor.cc112
-rw-r--r--src/google/protobuf/descriptor.pb.cc517
-rw-r--r--src/google/protobuf/descriptor.pb.h853
-rw-r--r--src/google/protobuf/descriptor_unittest.cc3
-rw-r--r--src/google/protobuf/duration.pb.cc10
-rw-r--r--src/google/protobuf/duration.pb.h19
-rw-r--r--src/google/protobuf/dynamic_message.cc78
-rw-r--r--src/google/protobuf/dynamic_message_unittest.cc68
-rw-r--r--src/google/protobuf/empty.pb.cc10
-rw-r--r--src/google/protobuf/empty.pb.h19
-rw-r--r--src/google/protobuf/extension_set.cc16
-rw-r--r--src/google/protobuf/extension_set.h2
-rw-r--r--src/google/protobuf/extension_set_heavy.cc10
-rw-r--r--src/google/protobuf/extension_set_unittest.cc9
-rw-r--r--src/google/protobuf/field_mask.pb.cc16
-rw-r--r--src/google/protobuf/field_mask.pb.h19
-rw-r--r--src/google/protobuf/generated_enum_reflection.h1
-rw-r--r--src/google/protobuf/generated_enum_util.h2
-rw-r--r--src/google/protobuf/generated_message_reflection.cc12
-rw-r--r--src/google/protobuf/generated_message_reflection.h8
-rw-r--r--src/google/protobuf/generated_message_table_driven_lite.h54
-rw-r--r--src/google/protobuf/generated_message_util.h16
-rw-r--r--src/google/protobuf/implicit_weak_message.h51
-rw-r--r--src/google/protobuf/io/coded_stream.cc11
-rw-r--r--src/google/protobuf/io/coded_stream.h61
-rw-r--r--src/google/protobuf/map.h11
-rw-r--r--src/google/protobuf/map_entry_lite.h9
-rw-r--r--src/google/protobuf/map_field.cc7
-rw-r--r--src/google/protobuf/map_test.cc10
-rw-r--r--src/google/protobuf/map_unittest_proto3.proto120
-rw-r--r--src/google/protobuf/message.h12
-rw-r--r--src/google/protobuf/message_lite.h19
-rw-r--r--src/google/protobuf/reflection_ops.cc29
-rw-r--r--src/google/protobuf/repeated_field.cc16
-rw-r--r--src/google/protobuf/repeated_field.h257
-rw-r--r--src/google/protobuf/source_context.pb.cc14
-rw-r--r--src/google/protobuf/source_context.pb.h19
-rw-r--r--src/google/protobuf/struct.pb.cc34
-rw-r--r--src/google/protobuf/struct.pb.h74
-rw-r--r--src/google/protobuf/stubs/atomicops_internals_generic_gcc.h8
-rw-r--r--src/google/protobuf/stubs/io_win32.cc9
-rw-r--r--src/google/protobuf/stubs/port.h16
-rw-r--r--src/google/protobuf/stubs/structurally_valid.cc31
-rw-r--r--src/google/protobuf/stubs/structurally_valid_unittest.cc30
-rw-r--r--src/google/protobuf/timestamp.pb.cc10
-rw-r--r--src/google/protobuf/timestamp.pb.h19
-rw-r--r--src/google/protobuf/timestamp.proto8
-rw-r--r--src/google/protobuf/type.pb.cc120
-rw-r--r--src/google/protobuf/type.pb.h193
-rw-r--r--src/google/protobuf/unittest.proto3
-rw-r--r--src/google/protobuf/unittest_import_proto3.proto68
-rw-r--r--src/google/protobuf/unittest_lite_imports_nonlite.proto3
-rw-r--r--src/google/protobuf/util/field_comparator.cc10
-rw-r--r--src/google/protobuf/util/field_comparator.h11
-rw-r--r--src/google/protobuf/util/field_mask_util.h9
-rw-r--r--src/google/protobuf/util/field_mask_util_test.cc6
-rw-r--r--src/google/protobuf/util/internal/json_escaping.h8
-rw-r--r--src/google/protobuf/util/internal/json_objectwriter.cc13
-rw-r--r--src/google/protobuf/util/internal/json_objectwriter.h42
-rw-r--r--src/google/protobuf/util/internal/json_objectwriter_test.cc6
-rw-r--r--src/google/protobuf/util/internal/object_writer.h7
-rw-r--r--src/google/protobuf/util/internal/protostream_objectsource.cc2
-rw-r--r--src/google/protobuf/util/internal/utility.cc5
-rw-r--r--src/google/protobuf/util/json_util.cc4
-rw-r--r--src/google/protobuf/util/json_util.h8
-rw-r--r--src/google/protobuf/util/json_util_test.cc24
-rw-r--r--src/google/protobuf/util/message_differencer.cc10
-rw-r--r--src/google/protobuf/util/message_differencer.h14
-rw-r--r--src/google/protobuf/wire_format_lite.cc189
-rw-r--r--src/google/protobuf/wire_format_lite.h18
-rw-r--r--src/google/protobuf/wire_format_lite_inl.h27
-rw-r--r--src/google/protobuf/wire_format_unittest.cc1
-rw-r--r--src/google/protobuf/wrappers.pb.cc58
-rw-r--r--src/google/protobuf/wrappers.pb.h91
-rwxr-xr-xtests.sh10
291 files changed, 16247 insertions, 9231 deletions
diff --git a/.travis.yml b/.travis.yml
index e7853ebe..6e34d45a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,55 +1,57 @@
-sudo: required
-dist: trusty
-# Note: travis currently does not support listing more than one language so
-# this cheats and claims to only be cpp. If they add multiple language
-# support, this should probably get updated to install steps and/or
-# rvm/gemfile/jdk/etc. entries rather than manually doing the work.
+# Everything is driven by the test.sh, so the language doesn't really
+# matter, it just controls the default install/script/etc. steps on
+# travis.
language: cpp
-os:
- - osx
-# The Objective C build needs Xcode 7.0 or later.
-osx_image: xcode8.3
-script:
- - ./tests.sh $CONFIG
-env:
- - CONFIG=cpp
- - CONFIG=cpp_distcheck
- - CONFIG=golang
- - CONFIG=java_jdk7
- - CONFIG=java_oracle7
- - CONFIG=javanano_jdk7
- - CONFIG=javanano_oracle7
- - CONFIG=javascript
- # iOS build log was starting to choke travis UI, so split to cover the
- # Xcode Debug and Release Configurations independently.
- - CONFIG=objectivec_ios_debug
- - CONFIG=objectivec_ios_release
- - CONFIG=objectivec_osx
- - CONFIG=objectivec_cocoapods_integration
- - CONFIG=python
- - CONFIG=python_cpp
- - CONFIG=ruby21
- - CONFIG=ruby22
- - CONFIG=jruby
- - CONFIG=php5.6_mac
- - CONFIG=php7.0_mac
+script: ./tests.sh $CONFIG
+
+# The test matrix is manually built to cover a mix of linux and macOS
+# hosted setups; this lets some extra settings be done specific to each
+# host/language instead of forcing common values on all the tests.
matrix:
- exclude:
- # It's nontrivial to programmatically install a new JDK from the command
- # line on OS X, so we rely on testing on Linux for Java code.
+ include:
+ # -----------------------------------------------------------------
+ # macOS hosted tests for Objective-C
+
+ - os: osx
+ env: CONFIG=objectivec_osx
+ osx_image: xcode9.1
+ language: objective-c
+ # iOS build log was starting to choke travis UI, so split to cover the
+ # Xcode Debug and Release Configurations independently.
- os: osx
- env: CONFIG=java_jdk7
+ env: CONFIG=objectivec_ios_debug
+ osx_image: xcode9.1
+ language: objective-c
- os: osx
- env: CONFIG=java_oracle7
+ env: CONFIG=objectivec_ios_release
+ osx_image: xcode9.1
+ language: objective-c
- os: osx
- env: CONFIG=javanano_jdk7
+ env: CONFIG=objectivec_cocoapods_integration
+ osx_image: xcode9.1
+ language: objective-c
+
+ # -----------------------------------------------------------------
+ # macOS hosted tests for other languages.
+
- os: osx
- env: CONFIG=javanano_oracle7
- # Requires installing golang, currently travis.sh is doing that with apt-get
- # which doesn't work on OS X.
+ env: CONFIG=cpp
- os: osx
- env: CONFIG=golang
- include:
+ env: CONFIG=cpp_distcheck
+ - os: osx
+ env: CONFIG=javascript
+ - os: osx
+ env: CONFIG=python
+ - os: osx
+ env: CONFIG=python_cpp
+ - os: osx
+ env: CONFIG=php5.6_mac
+ - os: osx
+ env: CONFIG=php7.0_mac
+
+ # -----------------------------------------------------------------
+ # Linux hosted tests
+
# The dotnet environment requires Ubuntu 14.04 or 16.04. This
# configuration is effectively an "extra" one, outside the
# autogenerated matrix.
@@ -57,7 +59,8 @@ matrix:
env: CONFIG=csharp
language: csharp
dist: trusty
- dotnet: 1.0.1
+ sudo: required
+ dotnet: 1.0.4
mono: none
# This test is kept on travis because it doesn't play nicely with other
# tests on jenkins running in parallel.
@@ -67,25 +70,14 @@ matrix:
# fetch pre-built Linux protoc binaries in the test.
- os: linux
env: CONFIG=java_compatibility
+ sudo: required
+ dist: trusty
# The Python compatibility test currently only runs on Linux because it will
# fetch pre-built Linux protoc binaries in the test.
- os: linux
env: CONFIG=python_compatibility
- allow_failures:
- # These currently do not work on OS X but are being worked on by @haberman.
- - os: osx
- env: CONFIG=ruby22
- - os: osx
- env: CONFIG=jruby
- # https://github.com/google/protobuf/issues/1253 - Started failing when
- # we moved to an OS X image that is 10.11.
- - os: osx
- env: CONFIG=python_cpp
- # Mark the iOS test as flakey as xcodebuild some times fails to start the
- # iOS Simulator.
- - os: osx
- env: CONFIG=objectivec_ios_debug
- - os: osx
- env: CONFIG=objectivec_ios_release
+ sudo: required
+ dist: trusty
+
notifications:
email: false
diff --git a/BUILD b/BUILD
index bcaf9cd5..547181e8 100644
--- a/BUILD
+++ b/BUILD
@@ -24,6 +24,8 @@ COPTS = select({
"-Woverloaded-virtual",
"-Wno-sign-compare",
"-Wno-unused-function",
+ # Prevents ISO C++ const string assignment warnings for pyext sources.
+ "-Wno-writable-strings",
],
})
@@ -70,6 +72,7 @@ cc_library(
"src/google/protobuf/extension_set.cc",
"src/google/protobuf/generated_message_table_driven_lite.cc",
"src/google/protobuf/generated_message_util.cc",
+ "src/google/protobuf/implicit_weak_message.cc",
"src/google/protobuf/io/coded_stream.cc",
"src/google/protobuf/io/zero_copy_stream.cc",
"src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
@@ -732,6 +735,7 @@ py_proto_library(
":python_srcs",
"//external:six",
],
+ py_extra_srcs = glob(["python/**/__init__.py"]),
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
)
diff --git a/Makefile.am b/Makefile.am
index 19a16071..d392429f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -211,6 +211,7 @@ java_EXTRA_DIST=
java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java \
java/core/src/main/java/com/google/protobuf/AbstractParser.java \
java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java \
+ java/core/src/main/java/com/google/protobuf/Android.java \
java/core/src/main/java/com/google/protobuf/BlockingRpcChannel.java \
java/core/src/main/java/com/google/protobuf/BlockingService.java \
java/core/src/main/java/com/google/protobuf/BooleanArrayList.java \
@@ -293,6 +294,7 @@ java_EXTRA_DIST=
java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java \
java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java \
java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java \
+ java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java \
java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java \
java/core/src/test/java/com/google/protobuf/DescriptorsTest.java \
java/core/src/test/java/com/google/protobuf/DiscardUnknownFieldsTest.java \
@@ -565,15 +567,20 @@ objectivec_EXTRA_DIST= \
objectivec/Tests/GPBWireFormatTests.m \
objectivec/Tests/iOSTestHarness/AppDelegate.m \
objectivec/Tests/iOSTestHarness/en.lproj/InfoPlist.strings \
- objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json \
- objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.png \
- objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6_2x.png \
- objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.png \
- objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7_2x.png \
- objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.png \
- objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6_2x.png \
- objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_2x.png \
- objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_3x.png \
+ objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_20.png \
+ objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_29.png \
+ objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_40.png \
+ objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_58.png \
+ objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_60.png \
+ objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_76.png \
+ objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_80.png \
+ objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_87.png \
+ objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_120.png \
+ objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_152.png \
+ objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_167.png \
+ objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_180.png \
+ objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_1024.png \
+ objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json \
objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json \
objectivec/Tests/iOSTestHarness/Info.plist \
objectivec/Tests/iOSTestHarness/LaunchScreen.xib \
diff --git a/benchmarks/Makefile.am b/benchmarks/Makefile.am
index d98eae5e..e9e08a0d 100644
--- a/benchmarks/Makefile.am
+++ b/benchmarks/Makefile.am
@@ -1,65 +1,36 @@
-
-benchmarks_protoc_inputs = \
- benchmarks.proto \
- benchmark_messages_proto3.proto
-
-benchmarks_protoc_inputs_proto2 = \
- benchmark_messages_proto2.proto
-
-benchmarks_protoc_outputs = \
- benchmarks.pb.cc \
- benchmarks.pb.h \
- benchmark_messages_proto3.pb.cc \
- benchmark_messages_proto3.pb.h
-
-benchmarks_protoc_outputs_proto2 = \
- benchmark_messages_proto2.pb.cc \
- benchmark_messages_proto2.pb.h
-
-AM_CXXFLAGS = $(NO_OPT_CXXFLAGS) $(PROTOBUF_OPT_FLAG) -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
-
-bin_PROGRAMS = generate-datasets cpp-benchmark
-
-generate_datasets_LDADD = $(top_srcdir)/src/libprotobuf.la
-generate_datasets_SOURCES = generate_datasets.cc
-generate_datasets_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)
-nodist_generate_datasets_SOURCES = \
- $(benchmarks_protoc_outputs) \
- $(benchmarks_protoc_outputs_proto2)
-
-# Explicit deps because BUILT_SOURCES are only done before a "make all/check"
-# so a direct "make test_cpp" could fail if parallel enough.
-# See: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Recording-Dependencies-manually
-generate_datasets-generate_datasets.$(OBJEXT): benchmarks.pb.h
-
-cpp_benchmark_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a
-cpp_benchmark_SOURCES = cpp_benchmark.cc
-cpp_benchmark_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir) -I$(top_srcdir)/third_party/benchmark/include
-nodist_cpp_benchmark_SOURCES = \
- $(benchmarks_protoc_outputs) \
- $(benchmarks_protoc_outputs_proto2)
-
-$(benchmarks_protoc_outputs): protoc_middleman
-$(benchmarks_protoc_outputs_proto2): protoc_middleman2
-
-CLEANFILES = \
- $(benchmarks_protoc_outputs) \
- $(benchmarks_protoc_outputs_proto2) \
- protoc_middleman \
- protoc_middleman2 \
- dataset.*
-
-MAINTAINERCLEANFILES = \
- Makefile.in
+benchmarks_protoc_inputs = \
+ benchmarks.proto \
+ datasets/google_message1/benchmark_message1_proto3.proto
+
+benchmarks_protoc_inputs_proto2 = \
+ datasets/google_message1/benchmark_message1_proto2.proto \
+ datasets/google_message2/benchmark_message2.proto \
+ datasets/google_message3/benchmark_message3.proto \
+ datasets/google_message3/benchmark_message3_1.proto \
+ datasets/google_message3/benchmark_message3_2.proto \
+ datasets/google_message3/benchmark_message3_3.proto \
+ datasets/google_message3/benchmark_message3_4.proto \
+ datasets/google_message3/benchmark_message3_5.proto \
+ datasets/google_message3/benchmark_message3_6.proto \
+ datasets/google_message3/benchmark_message3_7.proto \
+ datasets/google_message3/benchmark_message3_8.proto \
+ datasets/google_message4/benchmark_message4.proto \
+ datasets/google_message4/benchmark_message4_1.proto \
+ datasets/google_message4/benchmark_message4_2.proto \
+ datasets/google_message4/benchmark_message4_3.proto
+
+make_tmp_dir:
+ mkdir -p 'tmp'
+ touch make_tmp_dir
if USE_EXTERNAL_PROTOC
-protoc_middleman: $(benchmarks_protoc_inputs)
- $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. $(benchmarks_protoc_inputs)
+protoc_middleman: make_tmp_dir $(benchmarks_protoc_inputs)
+ $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=./tmp $(benchmarks_protoc_inputs)
touch protoc_middleman
-protoc_middleman2: $(benchmarks_protoc_inputs_proto2)
- $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. $(benchmarks_protoc_inputs_proto2)
+protoc_middleman2: make_tmp_dir $(benchmarks_protoc_inputs_proto2)
+ $(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. --java_out=./tmp $(benchmarks_protoc_inputs_proto2)
touch protoc_middleman2
else
@@ -67,12 +38,124 @@ else
# We have to cd to $(srcdir) before executing protoc because $(protoc_inputs) is
# relative to srcdir, which may not be the same as the current directory when
# building out-of-tree.
-protoc_middleman: $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs) $(well_known_type_protoc_inputs)
- oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd $(benchmarks_protoc_inputs) )
- touch protoc_middleman
-
-protoc_middleman2: $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs_proto2) $(well_known_type_protoc_inputs)
- oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd $(benchmarks_protoc_inputs_proto2) )
+protoc_middleman: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs) $(well_known_type_protoc_inputs)
+ oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd/tmp $(benchmarks_protoc_inputs) )
touch protoc_middleman
+protoc_middleman2: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs_proto2) $(well_known_type_protoc_inputs)
+ oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd --java_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2) )
+ touch protoc_middleman2
+
endif
+
+all_data = `find . -type f -name "dataset.*.pb"`
+
+############# CPP RULES ##############
+
+benchmarks_protoc_outputs = \
+ benchmarks.pb.cc \
+ datasets/google_message1/benchmark_message1_proto3.pb.cc
+
+benchmarks_protoc_outputs_header = \
+ benchmarks.pb.h \
+ datasets/google_message1/benchmark_message1_proto3.pb.h
+
+benchmarks_protoc_outputs_proto2_header = \
+ datasets/google_message1/benchmark_message1_proto2.pb.h \
+ datasets/google_message2/benchmark_message2.pb.h \
+ datasets/google_message3/benchmark_message3.pb.h \
+ datasets/google_message3/benchmark_message3_1.pb.h \
+ datasets/google_message3/benchmark_message3_2.pb.h \
+ datasets/google_message3/benchmark_message3_3.pb.h \
+ datasets/google_message3/benchmark_message3_4.pb.h \
+ datasets/google_message3/benchmark_message3_5.pb.h \
+ datasets/google_message3/benchmark_message3_6.pb.h \
+ datasets/google_message3/benchmark_message3_7.pb.h \
+ datasets/google_message3/benchmark_message3_8.pb.h \
+ datasets/google_message4/benchmark_message4.pb.h \
+ datasets/google_message4/benchmark_message4_1.pb.h \
+ datasets/google_message4/benchmark_message4_2.pb.h \
+ datasets/google_message4/benchmark_message4_3.pb.h
+
+benchmarks_protoc_outputs_proto2 = \
+ datasets/google_message1/benchmark_message1_proto2.pb.cc \
+ datasets/google_message2/benchmark_message2.pb.cc \
+ datasets/google_message3/benchmark_message3.pb.cc \
+ datasets/google_message3/benchmark_message3_1.pb.cc \
+ datasets/google_message3/benchmark_message3_2.pb.cc \
+ datasets/google_message3/benchmark_message3_3.pb.cc \
+ datasets/google_message3/benchmark_message3_4.pb.cc \
+ datasets/google_message3/benchmark_message3_5.pb.cc \
+ datasets/google_message3/benchmark_message3_6.pb.cc \
+ datasets/google_message3/benchmark_message3_7.pb.cc \
+ datasets/google_message3/benchmark_message3_8.pb.cc \
+ datasets/google_message4/benchmark_message4.pb.cc \
+ datasets/google_message4/benchmark_message4_1.pb.cc \
+ datasets/google_message4/benchmark_message4_2.pb.cc \
+ datasets/google_message4/benchmark_message4_3.pb.cc
+
+
+$(benchmarks_protoc_outputs): protoc_middleman
+$(benchmarks_protoc_outputs_header): protoc_middleman
+$(benchmarks_protoc_outputs_proto2): protoc_middleman2
+$(benchmarks_protoc_outputs_proto2_header): protoc_middleman2
+
+AM_CXXFLAGS = $(NO_OPT_CXXFLAGS) $(PROTOBUF_OPT_FLAG) -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
+
+bin_PROGRAMS = cpp-benchmark
+
+cpp_benchmark_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a
+cpp_benchmark_SOURCES = cpp_benchmark.cc
+cpp_benchmark_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir) -I$(top_srcdir)/third_party/benchmark/include
+# Explicit deps because BUILT_SOURCES are only done before a "make all/check"
+# so a direct "make test_cpp" could fail if parallel enough.
+# See: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Recording-Dependencies-manually
+cpp_benchmark-cpp_benchmark.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header)
+nodist_cpp_benchmark_SOURCES = \
+ $(benchmarks_protoc_outputs) \
+ $(benchmarks_protoc_outputs_proto2) \
+ $(benchmarks_protoc_outputs_proto2_header) \
+ $(benchmarks_protoc_outputs_header)
+
+cpp: protoc_middleman protoc_middleman2 cpp-benchmark
+ ./cpp-benchmark $(all_data)
+
+############ CPP RULES END ############
+
+############# JAVA RULES ##############
+
+javac_middleman: ProtoBench.java protoc_middleman protoc_middleman2
+ jar=`ls $(top_srcdir)/java/util/target/*.jar` && \
+ jar1=`ls $(top_srcdir)/java/core/target/*.jar` && \
+ javac -d tmp -classpath ../java/target/classes:$$jar:$$jar1 ProtoBench.java $(benchmark_java_protoc_outputs_proto2) $(benchmarks_java_protoc_outputs) `find tmp -type f -name "*.java"`
+ @touch javac_middleman
+
+java-benchmark: javac_middleman
+ @echo "Writing shortcut script java-benchmark..."
+ @echo '#! /bin/sh' > java-benchmark
+ @jar=`ls $(top_srcdir)/java/util/target/*.jar` && \
+ jar1=`ls $(top_srcdir)/java/core/target/*.jar` && \
+ echo java -classpath tmp:../java/target/classes:$$jar:$$jar1 com.google.protocolbuffers.ProtoBench '$$@' >> java-benchmark
+ @chmod +x java-benchmark
+
+java: protoc_middleman protoc_middleman2 java-benchmark
+ ./java-benchmark $(all_data)
+
+############# JAVA RULES END ##############
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
+
+CLEANFILES = \
+ $(benchmarks_protoc_outputs) \
+ $(benchmarks_protoc_outputs_header) \
+ $(benchmarks_protoc_outputs_proto2) \
+ $(benchmarks_protoc_outputs_proto2_header) \
+ make_tmp_dir \
+ protoc_middleman \
+ protoc_middleman2 \
+ javac_middleman \
+ java-benchmark
+
+clean-local:
+ -rm -rf tmp/*
diff --git a/benchmarks/ProtoBench.java b/benchmarks/ProtoBench.java
index 86d62feb..cde9095d 100644
--- a/benchmarks/ProtoBench.java
+++ b/benchmarks/ProtoBench.java
@@ -30,67 +30,131 @@
package com.google.protocolbuffers;
+import com.google.protobuf.ByteString;
+import com.google.protobuf.CodedInputStream;
+import com.google.protobuf.CodedOutputStream;
+import com.google.protobuf.ExtensionRegistry;
+import com.google.protobuf.Message;
+import com.google.protobuf.benchmarks.Benchmarks.BenchmarkDataset;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
-import java.lang.reflect.Method;
-
-import com.google.protobuf.ByteString;
-import com.google.protobuf.CodedInputStream;
-import com.google.protobuf.CodedOutputStream;
-import com.google.protobuf.Message;
+import java.util.ArrayList;
+import java.util.List;
public class ProtoBench {
-
- private static final long MIN_SAMPLE_TIME_MS = 2 * 1000;
- private static final long TARGET_TIME_MS = 30 * 1000;
+
+ private static final long MIN_SAMPLE_TIME_MS = 1 * 1000;
+ private static final long TARGET_TIME_MS = 5 * 1000;
private ProtoBench() {
// Prevent instantiation
}
public static void main(String[] args) {
- if (args.length < 2 || (args.length % 2) != 0) {
- System.err.println("Usage: ProtoBench <descriptor type name> <input data>");
- System.err.println("The descriptor type name is the fully-qualified message name,");
- System.err.println("e.g. com.google.protocolbuffers.benchmark.Message1");
- System.err.println("(You can specify multiple pairs of descriptor type name and input data.)");
+ if (args.length < 1) {
+ System.err.println("Usage: ./java-benchmark <input data>");
+ System.err.println("input data is in the format of \"benchmarks.proto\"");
System.exit(1);
}
boolean success = true;
- for (int i = 0; i < args.length; i += 2) {
- success &= runTest(args[i], args[i + 1]);
+ for (int i = 0; i < args.length; i++) {
+ success &= runTest(args[i]);
}
System.exit(success ? 0 : 1);
}
+
+ public static ExtensionRegistry getExtensionsRegistry(BenchmarkDataset benchmarkDataset) {
+ ExtensionRegistry extensions = ExtensionRegistry.newInstance();
+ if (benchmarkDataset.getMessageName().equals("benchmarks.google_message3.GoogleMessage3")) {
+ benchmarks.google_message3.BenchmarkMessage38.registerAllExtensions(extensions);
+ benchmarks.google_message3.BenchmarkMessage37.registerAllExtensions(extensions);
+ benchmarks.google_message3.BenchmarkMessage36.registerAllExtensions(extensions);
+ benchmarks.google_message3.BenchmarkMessage35.registerAllExtensions(extensions);
+ benchmarks.google_message3.BenchmarkMessage34.registerAllExtensions(extensions);
+ benchmarks.google_message3.BenchmarkMessage33.registerAllExtensions(extensions);
+ benchmarks.google_message3.BenchmarkMessage32.registerAllExtensions(extensions);
+ benchmarks.google_message3.BenchmarkMessage31.registerAllExtensions(extensions);
+ benchmarks.google_message3.BenchmarkMessage3.registerAllExtensions(extensions);
+ } else if (benchmarkDataset.getMessageName().equals(
+ "benchmarks.google_message4.GoogleMessage4")) {
+ benchmarks.google_message4.BenchmarkMessage43.registerAllExtensions(extensions);
+ benchmarks.google_message4.BenchmarkMessage42.registerAllExtensions(extensions);
+ benchmarks.google_message4.BenchmarkMessage41.registerAllExtensions(extensions);
+ benchmarks.google_message4.BenchmarkMessage4.registerAllExtensions(extensions);
+ }
+
+ return extensions;
+ }
+
+ /**
+ * Return an message instance for one specific dataset, and register the extensions for that
+ * message.
+ */
+ public static Message registerBenchmarks(BenchmarkDataset benchmarkDataset) {
+ if (benchmarkDataset.getMessageName().equals("benchmarks.proto3.GoogleMessage1")) {
+ return com.google.protobuf.benchmarks.BenchmarkMessage1Proto3.GoogleMessage1
+ .getDefaultInstance();
+ } else if (benchmarkDataset.getMessageName().equals("benchmarks.proto2.GoogleMessage1")) {
+ return com.google.protobuf.benchmarks.BenchmarkMessage1Proto2.GoogleMessage1
+ .getDefaultInstance();
+ } else if (benchmarkDataset.getMessageName().equals("benchmarks.proto2.GoogleMessage2")) {
+ return com.google.protobuf.benchmarks.BenchmarkMessage2.GoogleMessage2.getDefaultInstance();
+ } else if (benchmarkDataset.getMessageName().
+ equals("benchmarks.google_message3.GoogleMessage3")) {
+ return benchmarks.google_message3.BenchmarkMessage3.GoogleMessage3.getDefaultInstance();
+ } else if (benchmarkDataset.getMessageName().
+ equals("benchmarks.google_message4.GoogleMessage4")) {
+ return benchmarks.google_message4.BenchmarkMessage4.GoogleMessage4.getDefaultInstance();
+ } else {
+ return null;
+ }
+ }
/**
- * Runs a single test. Error messages are displayed to stderr, and the return value
- * indicates general success/failure.
+ * Runs a single test. Error messages are displayed to stderr, and the return value indicates
+ * general success/failure.
*/
- public static boolean runTest(String type, String file) {
- System.out.println("Benchmarking " + type + " with file " + file);
+ public static boolean runTest(String file) {
final Message defaultMessage;
+ BenchmarkDataset benchmarkDataset;
+ ExtensionRegistry extensions;
+ final byte[] inputData;
+
try {
- Class<?> clazz = Class.forName(type);
- Method method = clazz.getDeclaredMethod("getDefaultInstance");
- defaultMessage = (Message) method.invoke(null);
- } catch (Exception e) {
- // We want to do the same thing with all exceptions. Not generally nice,
- // but this is slightly different.
- System.err.println("Unable to get default message for " + type);
+ inputData = readAllBytes(file);
+ benchmarkDataset = BenchmarkDataset.parseFrom(inputData);
+ } catch (IOException e) {
+ System.err.println("Unable to get input data");
return false;
}
-
+ defaultMessage = registerBenchmarks(benchmarkDataset);
+ extensions = getExtensionsRegistry(benchmarkDataset);
+ if (defaultMessage == null) {
+ System.err.println("Unable to get default message " + benchmarkDataset.getMessageName());
+ return false;
+ }
+ System.out.println("Benchmarking " + benchmarkDataset.getMessageName() + " with file " + file);
+
try {
- final byte[] inputData = readAllBytes(file);
- final ByteArrayInputStream inputStream = new ByteArrayInputStream(inputData);
- final ByteString inputString = ByteString.copyFrom(inputData);
- final Message sampleMessage = defaultMessage.newBuilderForType().mergeFrom(inputString).build();
+ List<byte[]> inputDataList = new ArrayList<byte[]>();
+ List<ByteArrayInputStream> inputStreamList = new ArrayList<ByteArrayInputStream>();
+ List<ByteString> inputStringList = new ArrayList<ByteString>();
+ List<Message> sampleMessageList = new ArrayList<Message>();
+
+ for (int i = 0; i < benchmarkDataset.getPayloadCount(); i++) {
+ byte[] singleInputData = benchmarkDataset.getPayload(i).toByteArray();
+ inputDataList.add(benchmarkDataset.getPayload(i).toByteArray());
+ inputStreamList.add(new ByteArrayInputStream(benchmarkDataset.getPayload(i).toByteArray()));
+ inputStringList.add(benchmarkDataset.getPayload(i));
+ sampleMessageList.add(
+ defaultMessage.newBuilderForType().mergeFrom(singleInputData, extensions).build());
+ }
+
FileOutputStream devNullTemp = null;
CodedOutputStream reuseDevNullTemp = null;
try {
@@ -101,48 +165,100 @@ public class ProtoBench {
}
final FileOutputStream devNull = devNullTemp;
final CodedOutputStream reuseDevNull = reuseDevNullTemp;
- benchmark("Serialize to byte string", inputData.length, new Action() {
- public void execute() { sampleMessage.toByteString(); }
- });
- benchmark("Serialize to byte array", inputData.length, new Action() {
- public void execute() { sampleMessage.toByteArray(); }
- });
- benchmark("Serialize to memory stream", inputData.length, new Action() {
- public void execute() throws IOException {
- sampleMessage.writeTo(new ByteArrayOutputStream());
- }
- });
+ benchmark(
+ "Serialize to byte string",
+ inputData.length,
+ new Action() {
+ public void execute() {
+ for (int i = 0; i < sampleMessageList.size(); i++) {
+ sampleMessageList.get(i).toByteString();
+ }
+ }
+ });
+ benchmark(
+ "Serialize to byte array",
+ inputData.length,
+ new Action() {
+ public void execute() {
+ for (int i = 0; i < sampleMessageList.size(); i++) {
+ sampleMessageList.get(i).toByteString();
+ }
+ }
+ });
+ benchmark(
+ "Serialize to memory stream",
+ inputData.length,
+ new Action() {
+ public void execute() throws IOException {
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ for (int i = 0; i < sampleMessageList.size(); i++) {
+ sampleMessageList.get(i).writeTo(output);
+ }
+ }
+ });
if (devNull != null) {
- benchmark("Serialize to /dev/null with FileOutputStream", inputData.length, new Action() {
- public void execute() throws IOException {
- sampleMessage.writeTo(devNull);
- }
- });
- benchmark("Serialize to /dev/null reusing FileOutputStream", inputData.length, new Action() {
- public void execute() throws IOException {
- sampleMessage.writeTo(reuseDevNull);
- reuseDevNull.flush(); // force the write to the OutputStream
- }
- });
+ benchmark(
+ "Serialize to /dev/null with FileOutputStream",
+ inputData.length,
+ new Action() {
+ public void execute() throws IOException {
+ for (int i = 0; i < sampleMessageList.size(); i++) {
+ sampleMessageList.get(i).writeTo(devNull);
+ }
+ }
+ });
+ benchmark(
+ "Serialize to /dev/null reusing FileOutputStream",
+ inputData.length,
+ new Action() {
+ public void execute() throws IOException {
+ for (int i = 0; i < sampleMessageList.size(); i++) {
+ sampleMessageList.get(i).writeTo(reuseDevNull);
+ reuseDevNull.flush(); // force the write to the OutputStream
+ }
+ }
+ });
}
- benchmark("Deserialize from byte string", inputData.length, new Action() {
- public void execute() throws IOException {
- defaultMessage.newBuilderForType().mergeFrom(inputString).build();
- }
- });
- benchmark("Deserialize from byte array", inputData.length, new Action() {
- public void execute() throws IOException {
- defaultMessage.newBuilderForType()
- .mergeFrom(CodedInputStream.newInstance(inputData)).build();
- }
- });
- benchmark("Deserialize from memory stream", inputData.length, new Action() {
- public void execute() throws IOException {
- defaultMessage.newBuilderForType()
- .mergeFrom(CodedInputStream.newInstance(inputStream)).build();
- inputStream.reset();
- }
- });
+ benchmark(
+ "Deserialize from byte string",
+ inputData.length,
+ new Action() {
+ public void execute() throws IOException {
+ for (int i = 0; i < inputStringList.size(); i++) {
+ defaultMessage
+ .newBuilderForType()
+ .mergeFrom(inputStringList.get(i), extensions)
+ .build();
+ }
+ }
+ });
+ benchmark(
+ "Deserialize from byte array",
+ inputData.length,
+ new Action() {
+ public void execute() throws IOException {
+ for (int i = 0; i < inputDataList.size(); i++) {
+ defaultMessage
+ .newBuilderForType()
+ .mergeFrom(CodedInputStream.newInstance(inputDataList.get(i)), extensions)
+ .build();
+ }
+ }
+ });
+ benchmark(
+ "Deserialize from memory stream",
+ inputData.length,
+ new Action() {
+ public void execute() throws IOException {
+ for (int i = 0; i < inputStreamList.size(); i++) {
+ defaultMessage
+ .newBuilderForType()
+ .mergeFrom(CodedInputStream.newInstance(inputStreamList.get(i)), extensions)
+ .build();
+ inputStreamList.get(i).reset();
+ }
+ }
+ });
System.out.println();
return true;
} catch (Exception e) {
diff --git a/benchmarks/README.md b/benchmarks/README.md
index c9027805..0273e389 100644
--- a/benchmarks/README.md
+++ b/benchmarks/README.md
@@ -7,19 +7,42 @@ protobuf language runtime.
The schema for the datasets is described in `benchmarks.proto`.
-Generate the data sets like so:
+To run all the benchmark dataset:
+
+For java:
+
+```
+$ make java
+```
+
+For cpp:
```
-$ make
-$ ./generate-datasets
-Wrote dataset: dataset.google_message1_proto3.pb
-Wrote dataset: dataset.google_message1_proto2.pb
-Wrote dataset: dataset.google_message2.pb
-$
+$ make cpp
```
-Each data set will be written to its own file. Benchmarks will
-likely want to run several benchmarks against each data set (parse,
+To run a specific dataset:
+
+For java:
+
+```
+$ make java
+$ ./java-benchmark $(specific generated dataset file name)
+```
+
+For cpp:
+
+```
+$ make cpp
+$ ./cpp-benchmark $(specific generated dataset file name)
+```
+
+Each data set is in the format of benchmarks.proto:
+1. name is the benchmark dataset's name.
+2. message_name is the benchmark's message type full name (including package and message name)
+3. payload is the list of raw data.
+
+Benchmark likely want to run several benchmarks against each data set (parse,
serialize, possibly JSON, possibly using different APIs, etc).
We would like to add more data sets. In general we will favor data sets
diff --git a/benchmarks/benchmark_messages_proto2.proto b/benchmarks/benchmark_messages_proto2.proto
deleted file mode 100644
index 59085503..00000000
--- a/benchmarks/benchmark_messages_proto2.proto
+++ /dev/null
@@ -1,143 +0,0 @@
-// Benchmark messages for proto2.
-
-syntax = "proto2";
-
-package benchmarks.proto2;
-option java_package = "com.google.protobuf.benchmarks";
-
-// This is the default, but we specify it here explicitly.
-option optimize_for = SPEED;
-
-option cc_enable_arenas = true;
-
-message GoogleMessage1 {
- required string field1 = 1;
- optional string field9 = 9;
- optional string field18 = 18;
- optional bool field80 = 80 [default=false];
- optional bool field81 = 81 [default=true];
- required int32 field2 = 2;
- required int32 field3 = 3;
- optional int32 field280 = 280;
- optional int32 field6 = 6 [default=0];
- optional int64 field22 = 22;
- optional string field4 = 4;
- repeated fixed64 field5 = 5;
- optional bool field59 = 59 [default=false];
- optional string field7 = 7;
- optional int32 field16 = 16;
- optional int32 field130 = 130 [default=0];
- optional bool field12 = 12 [default=true];
- optional bool field17 = 17 [default=true];
- optional bool field13 = 13 [default=true];
- optional bool field14 = 14 [default=true];
- optional int32 field104 = 104 [default=0];
- optional int32 field100 = 100 [default=0];
- optional int32 field101 = 101 [default=0];
- optional string field102 = 102;
- optional string field103 = 103;
- optional int32 field29 = 29 [default=0];
- optional bool field30 = 30 [default=false];
- optional int32 field60 = 60 [default=-1];
- optional int32 field271 = 271 [default=-1];
- optional int32 field272 = 272 [default=-1];
- optional int32 field150 = 150;
- optional int32 field23 = 23 [default=0];
- optional bool field24 = 24 [default=false];
- optional int32 field25 = 25 [default=0];
- optional GoogleMessage1SubMessage field15 = 15;
- optional bool field78 = 78;
- optional int32 field67 = 67 [default=0];
- optional int32 field68 = 68;
- optional int32 field128 = 128 [default=0];
- optional string field129 = 129 [default="xxxxxxxxxxxxxxxxxxxxx"];
- optional int32 field131 = 131 [default=0];
-}
-
-message GoogleMessage1SubMessage {
- optional int32 field1 = 1 [default=0];
- optional int32 field2 = 2 [default=0];
- optional int32 field3 = 3 [default=0];
- optional string field15 = 15;
- optional bool field12 = 12 [default=true];
- optional int64 field13 = 13;
- optional int64 field14 = 14;
- optional int32 field16 = 16;
- optional int32 field19 = 19 [default=2];
- optional bool field20 = 20 [default=true];
- optional bool field28 = 28 [default=true];
- optional fixed64 field21 = 21;
- optional int32 field22 = 22;
- optional bool field23 = 23 [ default=false ];
- optional bool field206 = 206 [default=false];
- optional fixed32 field203 = 203;
- optional int32 field204 = 204;
- optional string field205 = 205;
- optional uint64 field207 = 207;
- optional uint64 field300 = 300;
-}
-
-message GoogleMessage2 {
- optional string field1 = 1;
- optional int64 field3 = 3;
- optional int64 field4 = 4;
- optional int64 field30 = 30;
- optional bool field75 = 75 [default=false];
- optional string field6 = 6;
- optional bytes field2 = 2;
- optional int32 field21 = 21 [default=0];
- optional int32 field71 = 71;
- optional float field25 = 25;
- optional int32 field109 = 109 [default=0];
- optional int32 field210 = 210 [default=0];
- optional int32 field211 = 211 [default=0];
- optional int32 field212 = 212 [default=0];
- optional int32 field213 = 213 [default=0];
- optional int32 field216 = 216 [default=0];
- optional int32 field217 = 217 [default=0];
- optional int32 field218 = 218 [default=0];
- optional int32 field220 = 220 [default=0];
- optional int32 field221 = 221 [default=0];
- optional float field222 = 222 [default=0.0];
- optional int32 field63 = 63;
-
- repeated group Group1 = 10 {
- required float field11 = 11;
- optional float field26 = 26;
- optional string field12 = 12;
- optional string field13 = 13;
- repeated string field14 = 14;
- required uint64 field15 = 15;
- optional int32 field5 = 5;
- optional string field27 = 27;
- optional int32 field28 = 28;
- optional string field29 = 29;
- optional string field16 = 16;
- repeated string field22 = 22;
- repeated int32 field73 = 73;
- optional int32 field20 = 20 [default=0];
- optional string field24 = 24;
- optional GoogleMessage2GroupedMessage field31 = 31;
- }
- repeated string field128 = 128;
- optional int64 field131 = 131;
- repeated string field127 = 127;
- optional int32 field129 = 129;
- repeated int64 field130 = 130;
- optional bool field205 = 205 [default=false];
- optional bool field206 = 206 [default=false];
-}
-
-message GoogleMessage2GroupedMessage {
- optional float field1 = 1;
- optional float field2 = 2;
- optional float field3 = 3 [default=0.0];
- optional bool field4 = 4;
- optional bool field5 = 5;
- optional bool field6 = 6 [default=true];
- optional bool field7 = 7 [default=false];
- optional float field8 = 8;
- optional bool field9 = 9;
- optional float field10 = 10;
- optional int64 field11 = 11;
-}
diff --git a/benchmarks/cpp_benchmark.cc b/benchmarks/cpp_benchmark.cc
index 0e6febc2..e26c8d11 100644
--- a/benchmarks/cpp_benchmark.cc
+++ b/benchmarks/cpp_benchmark.cc
@@ -28,13 +28,16 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include <glob.h>
-#include <iostream>
#include <fstream>
+#include <iostream>
#include "benchmark/benchmark_api.h"
#include "benchmarks.pb.h"
-#include "benchmark_messages_proto2.pb.h"
-#include "benchmark_messages_proto3.pb.h"
+#include "datasets/google_message1/benchmark_message1_proto2.pb.h"
+#include "datasets/google_message1/benchmark_message1_proto3.pb.h"
+#include "datasets/google_message2/benchmark_message2.pb.h"
+#include "datasets/google_message3/benchmark_message3.pb.h"
+#include "datasets/google_message4/benchmark_message4.pb.h"
+
#define PREFIX "dataset."
#define SUFFIX ".pb"
@@ -219,6 +222,14 @@ void RegisterBenchmarks(const std::string& dataset_bytes) {
RegisterBenchmarksForType<benchmarks::proto2::GoogleMessage1>(dataset);
} else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage2") {
RegisterBenchmarksForType<benchmarks::proto2::GoogleMessage2>(dataset);
+ } else if (dataset.message_name() ==
+ "benchmarks.google_message3.GoogleMessage3") {
+ RegisterBenchmarksForType
+ <benchmarks::google_message3::GoogleMessage3>(dataset);
+ } else if (dataset.message_name() ==
+ "benchmarks.google_message4.GoogleMessage4") {
+ RegisterBenchmarksForType
+ <benchmarks::google_message4::GoogleMessage4>(dataset);
} else {
std::cerr << "Unknown message type: " << dataset.message_name();
exit(1);
@@ -226,15 +237,15 @@ void RegisterBenchmarks(const std::string& dataset_bytes) {
}
int main(int argc, char *argv[]) {
- glob_t glob_result;
- if (glob("dataset.*.pb", 0, NULL, &glob_result) != 0) {
- fprintf(stderr, "No dataset files found.\n");
+ if (argc == 1) {
+ std::cerr << "Usage: ./cpp-benchmark <input data>" << std::endl;
+ std::cerr << "input data is in the format of \"benchmarks.proto\""
+ << std::endl;
return 1;
- }
-
- for (size_t i = 0; i < glob_result.gl_pathc; i++) {
- fprintf(stderr, "Found input dataset: %s\n", glob_result.gl_pathv[i]);
- RegisterBenchmarks(ReadFile(glob_result.gl_pathv[i]));
+ } else {
+ for (int i = 1; i < argc; i++) {
+ RegisterBenchmarks(ReadFile(argv[i]));
+ }
}
::benchmark::Initialize(&argc, argv);
diff --git a/benchmarks/datasets/google_message1/benchmark_message1_proto2.proto b/benchmarks/datasets/google_message1/benchmark_message1_proto2.proto
new file mode 100644
index 00000000..21261905
--- /dev/null
+++ b/benchmarks/datasets/google_message1/benchmark_message1_proto2.proto
@@ -0,0 +1,78 @@
+// Benchmark messages for proto2.
+
+syntax = "proto2";
+
+package benchmarks.proto2;
+option java_package = "com.google.protobuf.benchmarks";
+
+// This is the default, but we specify it here explicitly.
+option optimize_for = SPEED;
+
+option cc_enable_arenas = true;
+
+message GoogleMessage1 {
+ required string field1 = 1;
+ optional string field9 = 9;
+ optional string field18 = 18;
+ optional bool field80 = 80 [default = false];
+ optional bool field81 = 81 [default = true];
+ required int32 field2 = 2;
+ required int32 field3 = 3;
+ optional int32 field280 = 280;
+ optional int32 field6 = 6 [default = 0];
+ optional int64 field22 = 22;
+ optional string field4 = 4;
+ repeated fixed64 field5 = 5;
+ optional bool field59 = 59 [default = false];
+ optional string field7 = 7;
+ optional int32 field16 = 16;
+ optional int32 field130 = 130 [default = 0];
+ optional bool field12 = 12 [default = true];
+ optional bool field17 = 17 [default = true];
+ optional bool field13 = 13 [default = true];
+ optional bool field14 = 14 [default = true];
+ optional int32 field104 = 104 [default = 0];
+ optional int32 field100 = 100 [default = 0];
+ optional int32 field101 = 101 [default = 0];
+ optional string field102 = 102;
+ optional string field103 = 103;
+ optional int32 field29 = 29 [default = 0];
+ optional bool field30 = 30 [default = false];
+ optional int32 field60 = 60 [default = -1];
+ optional int32 field271 = 271 [default = -1];
+ optional int32 field272 = 272 [default = -1];
+ optional int32 field150 = 150;
+ optional int32 field23 = 23 [default = 0];
+ optional bool field24 = 24 [default = false];
+ optional int32 field25 = 25 [default = 0];
+ optional GoogleMessage1SubMessage field15 = 15;
+ optional bool field78 = 78;
+ optional int32 field67 = 67 [default = 0];
+ optional int32 field68 = 68;
+ optional int32 field128 = 128 [default = 0];
+ optional string field129 = 129 [default = "xxxxxxxxxxxxxxxxxxxxx"];
+ optional int32 field131 = 131 [default = 0];
+}
+
+message GoogleMessage1SubMessage {
+ optional int32 field1 = 1 [default = 0];
+ optional int32 field2 = 2 [default = 0];
+ optional int32 field3 = 3 [default = 0];
+ optional string field15 = 15;
+ optional bool field12 = 12 [default = true];
+ optional int64 field13 = 13;
+ optional int64 field14 = 14;
+ optional int32 field16 = 16;
+ optional int32 field19 = 19 [default = 2];
+ optional bool field20 = 20 [default = true];
+ optional bool field28 = 28 [default = true];
+ optional fixed64 field21 = 21;
+ optional int32 field22 = 22;
+ optional bool field23 = 23 [default = false];
+ optional bool field206 = 206 [default = false];
+ optional fixed32 field203 = 203;
+ optional int32 field204 = 204;
+ optional string field205 = 205;
+ optional uint64 field207 = 207;
+ optional uint64 field300 = 300;
+}
diff --git a/benchmarks/benchmark_messages_proto3.proto b/benchmarks/datasets/google_message1/benchmark_message1_proto3.proto
index 090b554b..090b554b 100644
--- a/benchmarks/benchmark_messages_proto3.proto
+++ b/benchmarks/datasets/google_message1/benchmark_message1_proto3.proto
diff --git a/benchmarks/google_message1.dat b/benchmarks/datasets/google_message1/dataset.google_message1_proto2.pb
index bc0f064c..f6fe7848 100644
--- a/benchmarks/google_message1.dat
+++ b/benchmarks/datasets/google_message1/dataset.google_message1_proto2.pb
Binary files differ
diff --git a/benchmarks/datasets/google_message1/dataset.google_message1_proto3.pb b/benchmarks/datasets/google_message1/dataset.google_message1_proto3.pb
new file mode 100644
index 00000000..4955bed3
--- /dev/null
+++ b/benchmarks/datasets/google_message1/dataset.google_message1_proto3.pb
Binary files differ
diff --git a/benchmarks/datasets/google_message2/benchmark_message2.proto b/benchmarks/datasets/google_message2/benchmark_message2.proto
new file mode 100644
index 00000000..820630e4
--- /dev/null
+++ b/benchmarks/datasets/google_message2/benchmark_message2.proto
@@ -0,0 +1,76 @@
+// Benchmark messages for proto2.
+
+syntax = "proto2";
+
+package benchmarks.proto2;
+option java_package = "com.google.protobuf.benchmarks";
+
+// This is the default, but we specify it here explicitly.
+option optimize_for = SPEED;
+
+option cc_enable_arenas = true;
+
+message GoogleMessage2 {
+ optional string field1 = 1;
+ optional int64 field3 = 3;
+ optional int64 field4 = 4;
+ optional int64 field30 = 30;
+ optional bool field75 = 75 [default = false];
+ optional string field6 = 6;
+ optional bytes field2 = 2;
+ optional int32 field21 = 21 [default = 0];
+ optional int32 field71 = 71;
+ optional float field25 = 25;
+ optional int32 field109 = 109 [default = 0];
+ optional int32 field210 = 210 [default = 0];
+ optional int32 field211 = 211 [default = 0];
+ optional int32 field212 = 212 [default = 0];
+ optional int32 field213 = 213 [default = 0];
+ optional int32 field216 = 216 [default = 0];
+ optional int32 field217 = 217 [default = 0];
+ optional int32 field218 = 218 [default = 0];
+ optional int32 field220 = 220 [default = 0];
+ optional int32 field221 = 221 [default = 0];
+ optional float field222 = 222 [default = 0.0];
+ optional int32 field63 = 63;
+
+ repeated group Group1 = 10 {
+ required float field11 = 11;
+ optional float field26 = 26;
+ optional string field12 = 12;
+ optional string field13 = 13;
+ repeated string field14 = 14;
+ required uint64 field15 = 15;
+ optional int32 field5 = 5;
+ optional string field27 = 27;
+ optional int32 field28 = 28;
+ optional string field29 = 29;
+ optional string field16 = 16;
+ repeated string field22 = 22;
+ repeated int32 field73 = 73;
+ optional int32 field20 = 20 [default = 0];
+ optional string field24 = 24;
+ optional GoogleMessage2GroupedMessage field31 = 31;
+ }
+ repeated string field128 = 128;
+ optional int64 field131 = 131;
+ repeated string field127 = 127;
+ optional int32 field129 = 129;
+ repeated int64 field130 = 130;
+ optional bool field205 = 205 [default = false];
+ optional bool field206 = 206 [default = false];
+}
+
+message GoogleMessage2GroupedMessage {
+ optional float field1 = 1;
+ optional float field2 = 2;
+ optional float field3 = 3 [default = 0.0];
+ optional bool field4 = 4;
+ optional bool field5 = 5;
+ optional bool field6 = 6 [default = true];
+ optional bool field7 = 7 [default = false];
+ optional float field8 = 8;
+ optional bool field9 = 9;
+ optional float field10 = 10;
+ optional int64 field11 = 11;
+}
diff --git a/benchmarks/google_message2.dat b/benchmarks/datasets/google_message2/dataset.google_message2.pb
index 06c09441..3fa0e49e 100644
--- a/benchmarks/google_message2.dat
+++ b/benchmarks/datasets/google_message2/dataset.google_message2.pb
Binary files differ
diff --git a/benchmarks/datasets/google_message3/benchmark_message3.proto b/benchmarks/datasets/google_message3/benchmark_message3.proto
new file mode 100644
index 00000000..c7033ed5
--- /dev/null
+++ b/benchmarks/datasets/google_message3/benchmark_message3.proto
@@ -0,0 +1,533 @@
+syntax = "proto2";
+
+import "datasets/google_message3/benchmark_message3_1.proto";
+import "datasets/google_message3/benchmark_message3_2.proto";
+import "datasets/google_message3/benchmark_message3_3.proto";
+import "datasets/google_message3/benchmark_message3_4.proto";
+import "datasets/google_message3/benchmark_message3_5.proto";
+import "datasets/google_message3/benchmark_message3_7.proto";
+import "datasets/google_message3/benchmark_message3_8.proto";
+package benchmarks.google_message3;
+
+option cc_enable_arenas = true;
+
+message GoogleMessage3 {
+ optional .benchmarks.google_message3.Message37487 field37519 = 2;
+ optional .benchmarks.google_message3.Message36876 field37520 = 3;
+ optional .benchmarks.google_message3.Message13062 field37521 = 4;
+ optional .benchmarks.google_message3.Message952 field37522 = 5;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37523 = 6;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37524 = 7;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37525 = 8;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37526 = 9;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37527 = 10;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37528 = 11;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37529 = 12;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37530 = 13;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37531 = 14;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37532 = 15;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37533 = 16;
+}
+
+message Message1327 {
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field1369 = 1;
+ repeated .benchmarks.google_message3.Message1328 field1370 = 3;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field1371 = 5;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field1372 = 6;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message1327 field1373 = 23104162;
+ }
+}
+
+message Message3672 {
+ optional .benchmarks.google_message3.Enum3476 field3727 = 1;
+ optional int32 field3728 = 11;
+ optional int32 field3729 = 2;
+ repeated group Message3673 = 3 {
+ required .benchmarks.google_message3.Enum3476 field3738 = 4;
+ required int32 field3739 = 5;
+ }
+ repeated group Message3674 = 6 {
+ required .benchmarks.google_message3.Enum3476 field3740 = 7;
+ required int32 field3741 = 8;
+ }
+ optional bool field3732 = 9;
+ optional int32 field3733 = 10;
+ optional .benchmarks.google_message3.Enum3476 field3734 = 20;
+ optional int32 field3735 = 21;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field3736 = 50;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message3672 field3737 = 3144435;
+ }
+}
+
+message Message3804 {
+ required int64 field3818 = 1;
+ required bool field3819 = 2;
+ repeated .benchmarks.google_message3.Enum3805 field3820 = 4;
+ optional int32 field3821 = 5;
+ optional bool field3822 = 6;
+ optional int64 field3823 = 7;
+ optional .benchmarks.google_message3.Enum3783 field3824 = 8;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message3804 field3825 = 59241828;
+ }
+}
+
+message Message6849 {
+ repeated .benchmarks.google_message3.Message6850 field6910 = 1;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message6849 field6911 = 107558455;
+ }
+}
+
+message Message6866 {
+ repeated .benchmarks.google_message3.Message6863 field6973 = 1;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message6866 field6974 = 22259060;
+ }
+}
+
+message Message6870 {
+ repeated .benchmarks.google_message3.Message6871 field6991 = 1;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message6870 field6992 = 90034652;
+ }
+}
+
+message Message7651 {
+ optional string field7685 = 1;
+ optional int64 field7686 = 2;
+ optional int64 field7687 = 3;
+ optional int64 field7688 = 4;
+ optional int32 field7689 = 5;
+ optional int32 field7690 = 6;
+ optional int32 field7691 = 7;
+ optional int32 field7692 = 8;
+ optional int32 field7693 = 9;
+ optional int32 field7694 = 10;
+ optional int32 field7695 = 11;
+ optional int32 field7696 = 12;
+ optional int32 field7697 = 13;
+ optional int32 field7698 = 14;
+ optional int32 field7699 = 15;
+ optional int32 field7700 = 16;
+ optional int32 field7701 = 17;
+ optional int32 field7702 = 18;
+ optional bool field7703 = 19;
+ repeated int32 field7704 = 20;
+ repeated int32 field7705 = 21;
+ repeated string field7706 = 22;
+ repeated string field7707 = 23;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field7708 = 24;
+ optional int32 field7709 = 25;
+ optional int32 field7710 = 26;
+ optional int32 field7711 = 27;
+ optional int32 field7712 = 43;
+ optional int32 field7713 = 28;
+ optional int32 field7714 = 29;
+ repeated .benchmarks.google_message3.Message7547 field7715 = 30;
+ repeated .benchmarks.google_message3.Message7547 field7716 = 31;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field7717 = 32;
+ repeated string field7718 = 33;
+ repeated string field7719 = 34;
+ repeated .benchmarks.google_message3.Message7648 field7720 = 35;
+ optional bool field7721 = 36;
+ optional bool field7722 = 37;
+ optional bool field7723 = 38;
+ optional bool field7724 = 39;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field7725 = 40;
+ optional .benchmarks.google_message3.UnusedEnum field7726 = 41;
+ optional .benchmarks.google_message3.Enum7654 field7727 = 42;
+ optional string field7728 = 44;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field7729 = 45;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message7651 field7730 = 55876009;
+ }
+}
+
+message Message7864 {
+ optional string field7866 = 1;
+ optional string field7867 = 2;
+ repeated .benchmarks.google_message3.Message7865 field7868 = 5;
+ repeated .benchmarks.google_message3.Message7865 field7869 = 6;
+ repeated .benchmarks.google_message3.Message7865 field7870 = 7;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field7871 = 8;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message7864 field7872 = 44542730;
+ }
+}
+
+message Message7929 {
+ optional int64 field7942 = 1;
+ optional int64 field7943 = 4;
+ optional int64 field7944 = 5;
+ optional int64 field7945 = 12;
+ optional int64 field7946 = 13;
+ optional int64 field7947 = 18;
+ optional int64 field7948 = 6;
+ optional int64 field7949 = 7;
+ repeated .benchmarks.google_message3.Message7919 field7950 = 8;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field7951 = 20;
+ repeated .benchmarks.google_message3.Message7920 field7952 = 14;
+ repeated .benchmarks.google_message3.Message7921 field7953 = 15;
+ repeated .benchmarks.google_message3.Message7928 field7954 = 17;
+ optional int64 field7955 = 19;
+ optional bool field7956 = 2;
+ optional int64 field7957 = 3;
+ optional int64 field7958 = 9;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field7959 = 10;
+ repeated bytes field7960 = 11;
+ optional int64 field7961 = 16;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message7929 field7962 = 53392238;
+ }
+}
+
+message Message8508 {
+ repeated .benchmarks.google_message3.Message8511 field8517 = 8;
+ repeated .benchmarks.google_message3.Message8512 field8518 = 9;
+ repeated .benchmarks.google_message3.Message8513 field8519 = 11;
+ optional bool field8520 = 13;
+ optional .benchmarks.google_message3.Message8514 field8521 = 14;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field8522 = 15;
+ repeated .benchmarks.google_message3.Message8515 field8523 = 16;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field8524 = 17;
+ optional int64 field8525 = 1;
+ optional float field8526 = 2;
+ optional int64 field8527 = 3;
+ optional int64 field8528 = 4;
+ optional int32 field8529 = 5;
+ optional bytes field8530 = 6;
+ repeated bytes field8531 = 7;
+ optional bool field8532 = 10;
+ optional bytes field8533 = 12;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message8508 field8534 = 3811804;
+ }
+}
+
+message Message9122 {
+ optional float field9132 = 1;
+ optional float field9133 = 2;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message9122 field9134 = 120398939;
+ }
+}
+
+message Message10177 {
+ repeated .benchmarks.google_message3.Message10155 field10270 = 1;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message10177 field10271 = 26801105;
+ }
+}
+
+message Message10278 {
+ repeated int32 field10286 = 1 [packed = true];
+ repeated int32 field10287 = 2 [packed = true];
+ optional int32 field10288 = 3;
+ extend .benchmarks.google_message3.Message10155 {
+ optional .benchmarks.google_message3.Message10278 field10289 = 29374161;
+ }
+}
+
+message Message10323 {
+ repeated .benchmarks.google_message3.Message10320 field10360 = 1;
+ extend .benchmarks.google_message3.Message10155 {
+ optional .benchmarks.google_message3.Message10323 field10361 = 27922524;
+ }
+}
+
+message Message10324 {
+ repeated .benchmarks.google_message3.Message10322 field10362 = 1;
+ optional .benchmarks.google_message3.Message10321 field10363 = 2;
+ extend .benchmarks.google_message3.Message10155 {
+ optional .benchmarks.google_message3.Message10324 field10364 = 27832297;
+ }
+}
+
+message Message11990 {
+ repeated .benchmarks.google_message3.Message11988 field12030 = 1;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message11990 field12031 = 21265426;
+ }
+}
+
+message Message12691 {
+ optional string field12713 = 1;
+ optional int32 field12714 = 2;
+ optional .benchmarks.google_message3.Message12668 field12715 = 3;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message12691 field12716 = 28426536;
+ }
+}
+
+message Message12870 {
+ required int32 field12879 = 1;
+ optional int32 field12880 = 7;
+ required int32 field12881 = 2;
+ optional uint64 field12882 = 3;
+ optional string field12883 = 2001;
+ optional fixed64 field12884 = 4;
+ repeated fixed64 field12885 = 14;
+ optional int32 field12886 = 9;
+ optional int64 field12887 = 18;
+ repeated .benchmarks.google_message3.Message12870 field12888 = 8;
+ optional int32 field12889 = 5;
+ optional uint64 field12890 = 6;
+ optional int32 field12891 = 10;
+ optional int32 field12892 = 11;
+ optional double field12893 = 12;
+ optional .benchmarks.google_message3.Message12825 field12894 = 13;
+ optional double field12895 = 15;
+ optional string field12896 = 16;
+ optional .benchmarks.google_message3.Enum12871 field12897 = 17;
+ optional int32 field12898 = 19;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message12870 field12899 = 5447656;
+ }
+}
+
+message Message13154 {
+ required float field13164 = 1;
+ required float field13165 = 2;
+ extend .benchmarks.google_message3.Message13145 {
+ optional .benchmarks.google_message3.Message13154 field13166 = 47301086;
+ }
+}
+
+message Message16507 {
+ optional bool field16510 = 3;
+ optional bool field16511 = 4;
+ optional bool field16512 = 14;
+ repeated string field16513 = 5;
+ repeated string field16514 = 6;
+ optional string field16515 = 8;
+ repeated int32 field16516 = 9;
+ repeated int32 field16517 = 10;
+ optional int32 field16518 = 7;
+ optional string field16519 = 15;
+ repeated string field16520 = 11;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16521 = 27;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16522 = 22;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16523 = 28;
+ optional string field16524 = 18;
+ optional int32 field16525 = 19;
+ optional int32 field16526 = 20;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field16527 = 23;
+ optional bool field16528 = 24;
+ repeated string field16529 = 25;
+ optional double field16530 = 26;
+ optional .benchmarks.google_message3.Message16478 field16531 = 30;
+ optional bool field16532 = 31;
+ optional string field16533 = 32;
+ optional bool field16534 = 33;
+ optional bool field16535 = 35;
+ optional bool field16536 = 36;
+ optional bool field16537 = 37;
+ optional bool field16538 = 38;
+ optional bool field16539 = 39;
+ optional bool field16540 = 40;
+ repeated string field16541 = 41;
+ extensions 21 to 21;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message16507 field16542 = 5569941;
+ }
+}
+
+message Message16564 {
+ repeated .benchmarks.google_message3.Message16552 field16568 = 1;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message16564 field16569 = 25830030;
+ }
+}
+
+message Message16661 {
+ repeated .benchmarks.google_message3.Message16660 field16671 = 1;
+ repeated uint64 field16672 = 2;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message16661 field16673 = 31274398;
+ }
+}
+
+message Message16746 {
+ repeated .benchmarks.google_message3.Message16727 field16806 = 1;
+ optional bool field16807 = 2;
+ optional bool field16808 = 3;
+ repeated .benchmarks.google_message3.Message16725 field16809 = 4;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message16746 field16810 = 28406765;
+ }
+}
+
+message Message17786 {
+ repeated group Message17787 = 1 {
+ required int32 field18177 = 2;
+ required int32 field18178 = 3;
+ optional .benchmarks.google_message3.Message17783 field18179 = 4;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18180 = 5;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18181 = 6;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field18182 = 8;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18183 = 9;
+ optional .benchmarks.google_message3.Message17726 field18184 = 10;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18185 = 11;
+ optional .benchmarks.google_message3.Message16945 field18186 = 102;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18187 = 12;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18188 = 13;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18189 = 7;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18190 = 100;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18191 = 101;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18192 = 14;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18193 = 19;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18194 = 22;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18195 = 24;
+ optional .benchmarks.google_message3.Enum16925 field18196 = 21;
+ optional bool field18197 = 18;
+ repeated .benchmarks.google_message3.UnusedEnum field18198 = 23;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18199 = 15;
+ optional string field18200 = 16;
+ optional string field18201 = 17;
+ optional bool field18202 = 99;
+ }
+ repeated .benchmarks.google_message3.Message17782 field18175 = 20;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message17786 field18176 = 11823055;
+ }
+}
+
+message Message22857 {
+ repeated .benchmarks.google_message3.Message22853 field22874 = 1;
+ extend .benchmarks.google_message3.Message10155 {
+ optional .benchmarks.google_message3.Message22857 field22875 = 67799715;
+ }
+}
+
+message Message24404 {
+ repeated group Message24405 = 1 {
+ required int32 field24686 = 2;
+ required int32 field24687 = 3;
+ optional .benchmarks.google_message3.Message24317 field24688 = 4;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24689 = 5;
+ optional .benchmarks.google_message3.Message24376 field24690 = 6;
+ optional .benchmarks.google_message3.Message24345 field24691 = 7;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24692 = 8;
+ optional .benchmarks.google_message3.Message24379 field24693 = 9;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24694 = 10;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24695 = 11;
+ optional .benchmarks.google_message3.Message24391 field24696 = 12;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24697 = 13;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24698 = 14;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24699 = 22;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24700 = 23;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24701 = 25;
+ optional .benchmarks.google_message3.Enum16925 field24702 = 18;
+ optional float field24703 = 20;
+ optional bool field24704 = 19;
+ repeated .benchmarks.google_message3.Enum16891 field24705 = 24;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24706 = 15;
+ optional string field24707 = 16;
+ optional string field24708 = 17;
+ optional float field24709 = 21;
+ optional bool field24710 = 26;
+ optional .benchmarks.google_message3.UnusedEnum field24711 = 27;
+ optional bool field24712 = 28;
+ optional .benchmarks.google_message3.UnusedEnum field24713 = 29;
+ optional bool field24714 = 31;
+ optional bool field24715 = 99;
+ optional int64 field24716 = 32;
+ }
+ optional .benchmarks.google_message3.Message24403 field24684 = 30;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message24404 field24685 = 9129287;
+ }
+}
+
+message Message27300 {
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field27302 = 1;
+ optional string field27303 = 2;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message27300 field27304 = 24956467;
+ }
+}
+
+message Message27453 {
+ optional string field27459 = 15;
+ repeated string field27460 = 1;
+ repeated float field27461 = 6;
+ repeated int32 field27462 = 27;
+ repeated int32 field27463 = 28;
+ repeated .benchmarks.google_message3.Message27454 field27464 = 24;
+ repeated string field27465 = 2;
+ repeated float field27466 = 7;
+ repeated string field27467 = 22;
+ repeated string field27468 = 23;
+ optional string field27469 = 26;
+ repeated .benchmarks.google_message3.Message27357 field27470 = 8;
+ optional .benchmarks.google_message3.Message27360 field27471 = 16;
+ optional string field27472 = 25;
+ optional string field27473 = 11;
+ optional bool field27474 = 13;
+ optional bool field27475 = 14;
+ optional bool field27476 = 17;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field27477 = 12;
+ optional bool field27478 = 34268945;
+ optional bool field27479 = 20;
+ optional string field27480 = 21;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field27481 = 10;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message27453 field27482 = 8086204;
+ }
+}
+
+extend .benchmarks.google_message3.Message16945 {
+ optional string field17026 = 472;
+ repeated string field17027 = 818;
+ optional .benchmarks.google_message3.Message0 field17031 = 215;
+ repeated .benchmarks.google_message3.Message0 field17032 = 292;
+ repeated .benchmarks.google_message3.Message0 field17038 = 234;
+ repeated .benchmarks.google_message3.Message0 field17039 = 235;
+ optional .benchmarks.google_message3.Message0 field17042 = 246;
+ optional string field17043 = 224;
+ optional string field17044 = 225;
+ repeated string field17048 = 63;
+ repeated string field17049 = 64;
+ repeated .benchmarks.google_message3.Message0 field17052 = 233;
+ repeated .benchmarks.google_message3.Message0 field17053 = 66;
+ repeated string field17056 = 275;
+ optional string field17057 = 226;
+ repeated .benchmarks.google_message3.Message0 field17060 = 27;
+ repeated string field17073 = 75;
+ repeated .benchmarks.google_message3.Message0 field17076 = 77;
+ repeated string field17078 = 296;
+ repeated .benchmarks.google_message3.Message0 field17082 = 160;
+ repeated .benchmarks.google_message3.Message0 field17091 = 585;
+ repeated .benchmarks.google_message3.Message0 field17098 = 987;
+ repeated .benchmarks.google_message3.Message0 field17101 = 157;
+ repeated string field17102 = 158;
+ repeated string field17107 = 166;
+ repeated string field17133 = 567;
+ repeated string field17134 = 572;
+ repeated string field17160 = 49;
+ repeated string field17168 = 32;
+ repeated string field17170 = 34;
+ repeated .benchmarks.google_message3.Message0 field17172 = 509;
+ repeated string field17174 = 39;
+ repeated .benchmarks.google_message3.Message0 field17175 = 40;
+ repeated .benchmarks.google_message3.Message0 field17178 = 511;
+ repeated .benchmarks.google_message3.Message0 field17185 = 50;
+ repeated int32 field17207 = 1081;
+ repeated .benchmarks.google_message3.Message0 field17238 = 184;
+ repeated .benchmarks.google_message3.Message0 field17289 = 177;
+ repeated .benchmarks.google_message3.Message0 field17290 = 178;
+ repeated .benchmarks.google_message3.Message0 field17296 = 474;
+ repeated string field17298 = 44;
+ repeated .benchmarks.google_message3.Message0 field17301 = 47;
+ optional .benchmarks.google_message3.Message0 field17412 = 21;
+ repeated .benchmarks.google_message3.Message0 field17438 = 132;
+ repeated .benchmarks.google_message3.Message0 field17458 = 512;
+ repeated string field17460 = 560;
+ repeated string field17466 = 552;
+ repeated .benchmarks.google_message3.Message0 field17617 = 1080;
+ repeated int32 field17618 = 1084;
+}
+
diff --git a/benchmarks/datasets/google_message3/benchmark_message3_1.proto b/benchmarks/datasets/google_message3/benchmark_message3_1.proto
new file mode 100644
index 00000000..1157c430
--- /dev/null
+++ b/benchmarks/datasets/google_message3/benchmark_message3_1.proto
@@ -0,0 +1,1279 @@
+syntax = "proto2";
+
+import "datasets/google_message3/benchmark_message3_2.proto";
+import "datasets/google_message3/benchmark_message3_3.proto";
+import "datasets/google_message3/benchmark_message3_5.proto";
+import "datasets/google_message3/benchmark_message3_7.proto";
+import "datasets/google_message3/benchmark_message3_8.proto";
+package benchmarks.google_message3;
+
+option cc_enable_arenas = true;
+
+message Message34390 {
+ repeated .benchmarks.google_message3.Message34387 field34452 = 1;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message34390 field34453 = 92144610;
+ }
+}
+
+message Message34624 {
+ optional .benchmarks.google_message3.Message34621 field34683 = 1;
+ optional .benchmarks.google_message3.Message34621 field34684 = 2;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message34624 field34685 = 18178548;
+ }
+}
+
+message Message34791 {
+ optional fixed64 field34793 = 1;
+ repeated group Message34792 = 2 {
+ required string field34808 = 3;
+ optional string field34809 = 4;
+ }
+ optional int32 field34795 = 5;
+ optional int32 field34796 = 6;
+ optional int32 field34797 = 7;
+ optional int32 field34798 = 8;
+ optional int32 field34799 = 9;
+ optional int32 field34800 = 10;
+ optional bool field34801 = 11;
+ optional float field34802 = 12;
+ optional int32 field34803 = 13;
+ optional string field34804 = 14;
+ optional int64 field34805 = 15;
+ repeated fixed64 field34806 = 17 [packed = true];
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message34791 field34807 = 6330340;
+ }
+}
+
+message Message35483 {
+ optional int32 field35499 = 1;
+ optional string field35500 = 2;
+ optional string field35501 = 3;
+ optional string field35502 = 4;
+ repeated .benchmarks.google_message3.Message35476 field35503 = 5;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field35504 = 6;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message35483 field35505 = 7913554;
+ }
+}
+
+message Message35807 {
+ optional int32 field35810 = 1;
+ optional int32 field35811 = 2;
+ optional int32 field35812 = 3;
+ optional int32 field35813 = 4;
+ optional int32 field35814 = 5;
+ optional int32 field35815 = 6;
+ optional int32 field35816 = 7;
+ optional int32 field35817 = 8;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message35807 field35818 = 3803299;
+ }
+}
+
+message Message37487 {
+ optional bytes field37501 = 2;
+ optional bool field37502 = 3;
+}
+
+message Message13062 {
+ optional int64 field13075 = 1;
+ optional string field13076 = 2;
+ optional int32 field13077 = 3;
+ optional string field13078 = 4;
+ optional int32 field13079 = 5;
+}
+
+message Message952 {
+ repeated .benchmarks.google_message3.Message949 field963 = 1;
+}
+
+message Message36876 {
+ optional .benchmarks.google_message3.Message2356 field36980 = 1;
+ repeated group Message36877 = 111 {
+ required string field37044 = 112;
+ optional int32 field37045 = 113;
+ optional bytes field37046 = 114;
+ optional int32 field37047 = 115;
+ optional int32 field37048 = 157;
+ }
+ repeated group Message36878 = 168 {
+ }
+ repeated group Message36879 = 55 {
+ required string field37050 = 56;
+ optional int32 field37051 = 69;
+ }
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field36984 = 78;
+ optional group Message36880 = 137 {
+ }
+ optional uint64 field36986 = 59;
+ optional bytes field36987 = 121;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field36988 = 2;
+ optional .benchmarks.google_message3.Message7029 field36989 = 118;
+ optional .benchmarks.google_message3.Message35573 field36990 = 11;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field36991 = 21;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field36992 = 22;
+ optional float field36993 = 13;
+ optional int32 field36994 = 20;
+ optional bool field36995 = 51;
+ optional bool field36996 = 57;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field36997 = 100;
+ optional int32 field36998 = 47;
+ optional int32 field36999 = 48;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37000 = 68;
+ repeated group Message36881 = 23 {
+ }
+ optional .benchmarks.google_message3.Message4144 field37002 = 125;
+ repeated group Message36882 = 35 {
+ }
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37004 = 49;
+ optional .benchmarks.google_message3.Message18921 field37005 = 52;
+ optional .benchmarks.google_message3.Message36858 field37006 = 46;
+ optional .benchmarks.google_message3.Message18831 field37007 = 54;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37008 = 58;
+ optional .benchmarks.google_message3.Message18283 field37009 = 10;
+ optional string field37010 = 44;
+ optional string field37011 = 103;
+ optional .benchmarks.google_message3.Message0 field37012 = 43;
+ optional .benchmarks.google_message3.Message0 field37013 = 143;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37014 = 53;
+ optional .benchmarks.google_message3.Message36869 field37015 = 15;
+ optional group Message36883 = 3 {
+ }
+ repeated group Message36884 = 16 {
+ }
+ repeated group Message36885 = 27 {
+ }
+ optional group Message36886 = 32 {
+ }
+ repeated .benchmarks.google_message3.UnusedEnum field37020 = 71;
+ repeated int32 field37021 = 70;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37022 = 66;
+ optional .benchmarks.google_message3.Message13090 field37023 = 67;
+ optional group Message36887 = 62 {
+ }
+ repeated .benchmarks.google_message3.Message10155 field37025 = 50;
+ repeated .benchmarks.google_message3.Message11874 field37026 = 151;
+ optional string field37027 = 12;
+ optional int64 field37028 = 72;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37029 = 73;
+ optional .benchmarks.google_message3.Message35546 field37030 = 108;
+ optional group Message36888 = 74 {
+ optional uint64 field37089 = 75;
+ optional bool field37090 = 76;
+ optional uint64 field37091 = 165;
+ optional double field37092 = 166;
+ optional uint64 field37093 = 109;
+ optional bytes field37094 = 122;
+ }
+ repeated .benchmarks.google_message3.Message19255 field37032 = 104;
+ optional .benchmarks.google_message3.Message33968 field37033 = 105;
+ optional bool field37034 = 106;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field37035 = 107;
+ optional .benchmarks.google_message3.Message6644 field37036 = 110;
+ optional bytes field37037 = 133;
+ optional group Message36889 = 116 {
+ optional int64 field37095 = 117;
+ optional string field37096 = 145;
+ optional int32 field37097 = 123;
+ optional bool field37098 = 163;
+ optional int32 field37099 = 164;
+ optional int32 field37100 = 149;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37101 = 129;
+ optional .benchmarks.google_message3.Message13174 field37102 = 124;
+ optional .benchmarks.google_message3.Message13169 field37103 = 128;
+ optional uint64 field37104 = 132;
+ repeated .benchmarks.google_message3.Enum36890 field37105 = 131;
+ optional bool field37106 = 134;
+ optional bool field37107 = 140;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37108 = 135;
+ optional float field37109 = 136;
+ optional float field37110 = 156;
+ optional bool field37111 = 142;
+ optional int64 field37112 = 167;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37113 = 146;
+ optional bool field37114 = 148;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37115 = 154;
+ optional .benchmarks.google_message3.UnusedEnum field37116 = 158;
+ repeated .benchmarks.google_message3.UnusedEnum field37117 = 159;
+ optional int32 field37118 = 160;
+ repeated string field37119 = 161;
+ }
+ repeated group Message36910 = 119 {
+ }
+ optional group Message36911 = 126 {
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37121 = 127;
+ optional .benchmarks.google_message3.Message35538 field37122 = 130;
+ optional .benchmarks.google_message3.Message35540 field37123 = 144;
+ optional .benchmarks.google_message3.Message35542 field37124 = 150;
+ }
+ optional group Message36912 = 152 {
+ optional .benchmarks.google_message3.Message3901 field37125 = 153;
+ optional .benchmarks.google_message3.Message3901 field37126 = 162;
+ }
+ optional .benchmarks.google_message3.UnusedEmptyMessage field37042 = 155;
+}
+
+message Message1328 {
+}
+
+message Message6850 {
+}
+
+message Message6863 {
+ optional .benchmarks.google_message3.Enum6858 field6931 = 1;
+ optional .benchmarks.google_message3.Enum6858 field6932 = 2;
+ optional .benchmarks.google_message3.UnusedEnum field6933 = 36;
+ optional bool field6934 = 27;
+ optional .benchmarks.google_message3.Message6773 field6935 = 26;
+ optional int32 field6936 = 30;
+ optional int32 field6937 = 37;
+ optional .benchmarks.google_message3.Enum6815 field6938 = 31;
+ optional string field6939 = 3;
+ optional int32 field6940 = 4;
+ optional .benchmarks.google_message3.Enum6822 field6941 = 15;
+ optional bool field6942 = 10;
+ optional bool field6943 = 17;
+ optional float field6944 = 18;
+ optional float field6945 = 19;
+ optional int32 field6946 = 5;
+ optional int32 field6947 = 6;
+ optional bool field6948 = 7;
+ optional int32 field6949 = 12;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6950 = 8;
+ optional uint64 field6951 = 9;
+ optional string field6952 = 11;
+ optional bytes field6953 = 13;
+ optional int32 field6954 = 14;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6955 = 16;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6956 = 22;
+ optional .benchmarks.google_message3.Message3886 field6957 = 38;
+ optional string field6958 = 20;
+ optional uint32 field6959 = 21;
+ optional .benchmarks.google_message3.Message6743 field6960 = 23;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6961 = 29;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6962 = 33;
+ optional bool field6963 = 34;
+}
+
+message Message6871 {
+}
+
+message Message7547 {
+ required bytes field7549 = 1;
+ required int32 field7550 = 2;
+}
+
+message Message7648 {
+ optional string field7669 = 1;
+ optional int32 field7670 = 2;
+ optional int32 field7671 = 3;
+ optional int32 field7672 = 4;
+ optional int32 field7673 = 5;
+ optional int32 field7674 = 6;
+ optional float field7675 = 7;
+ optional bool field7676 = 8;
+ optional bool field7677 = 9;
+ optional bool field7678 = 10;
+ optional bool field7679 = 11;
+ optional bool field7680 = 12;
+}
+
+message Message7865 {
+}
+
+message Message7928 {
+ optional string field7940 = 1;
+ optional int64 field7941 = 2;
+}
+
+message Message7919 {
+ optional fixed64 field7931 = 1;
+ optional int64 field7932 = 2;
+ optional bytes field7933 = 3;
+}
+
+message Message7920 {
+ optional int64 field7934 = 1;
+ optional int64 field7935 = 2;
+}
+
+message Message7921 {
+ optional int32 field7936 = 1;
+ optional int64 field7937 = 2;
+ optional float field7938 = 3;
+ optional .benchmarks.google_message3.UnusedEnum field7939 = 4;
+}
+
+message Message8511 {
+ optional .benchmarks.google_message3.Message8224 field8539 = 1;
+ optional string field8540 = 2;
+ optional bool field8541 = 3;
+ optional int64 field8542 = 4;
+ optional string field8543 = 5;
+}
+
+message Message8512 {
+ optional .benchmarks.google_message3.Message8301 field8544 = 1;
+ optional .benchmarks.google_message3.Message8302 field8545 = 2;
+ optional string field8546 = 3;
+ optional bool field8547 = 4;
+ optional int64 field8548 = 5;
+ optional string field8549 = 6;
+}
+
+message Message8513 {
+ repeated .benchmarks.google_message3.Message8392 field8550 = 1;
+ optional string field8551 = 2;
+ optional bool field8552 = 3;
+ optional string field8553 = 4;
+}
+
+message Message8514 {
+ optional string field8554 = 1;
+ optional int64 field8555 = 2;
+ optional bool field8556 = 3;
+ repeated .benchmarks.google_message3.Message8130 field8557 = 4;
+ optional string field8558 = 5;
+}
+
+message Message8515 {
+ optional .benchmarks.google_message3.Message8479 field8559 = 1;
+ optional .benchmarks.google_message3.Message8478 field8560 = 2;
+ optional string field8561 = 3;
+}
+
+message Message10320 {
+ optional .benchmarks.google_message3.Enum10335 field10347 = 1;
+ repeated .benchmarks.google_message3.Message10319 field10348 = 2;
+ optional int32 field10349 = 3;
+ optional int32 field10350 = 4;
+ optional int32 field10351 = 5;
+ optional int32 field10352 = 6;
+ optional .benchmarks.google_message3.Enum10337 field10353 = 7;
+}
+
+message Message10321 {
+ optional int32 field10354 = 1;
+ optional int32 field10355 = 2;
+ optional uint64 field10356 = 3;
+}
+
+message Message10322 {
+ optional .benchmarks.google_message3.Message4016 field10357 = 1;
+ optional bool field10358 = 2;
+ optional bool field10359 = 3;
+}
+
+message Message11988 {
+ optional string field12021 = 1;
+ optional string field12022 = 2;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field12023 = 3;
+ optional .benchmarks.google_message3.Message10155 field12024 = 4;
+}
+
+message Message12668 {
+ repeated .benchmarks.google_message3.Message12669 field12677 = 1;
+ optional int32 field12678 = 2;
+ optional int32 field12679 = 3;
+ optional int32 field12680 = 4;
+}
+
+message Message12825 {
+ repeated .benchmarks.google_message3.Message12818 field12862 = 1;
+ optional int32 field12863 = 2;
+ optional .benchmarks.google_message3.Message12819 field12864 = 3;
+ optional .benchmarks.google_message3.Message12820 field12865 = 4;
+ optional int32 field12866 = 5;
+ repeated .benchmarks.google_message3.Message12821 field12867 = 6;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field12868 = 7;
+}
+
+message Message16478 {
+ repeated .benchmarks.google_message3.Message16479 field16481 = 1;
+ optional bool field16482 = 3;
+ optional int32 field16483 = 2;
+}
+
+message Message16552 {
+ optional fixed64 field16565 = 1;
+ optional int32 field16566 = 2;
+ optional .benchmarks.google_message3.Enum16553 field16567 = 3;
+}
+
+message Message16660 {
+ optional string field16668 = 1;
+ optional string field16669 = 2;
+ optional int32 field16670 = 3;
+}
+
+message Message16727 {
+ required .benchmarks.google_message3.Enum16728 field16782 = 1;
+ required string field16783 = 2;
+ optional string field16784 = 3;
+ optional int32 field16785 = 23;
+ required string field16786 = 4;
+ optional string field16787 = 5;
+ optional string field16788 = 6;
+ required .benchmarks.google_message3.Enum16732 field16789 = 7;
+ optional string field16790 = 8;
+ optional string field16791 = 9;
+ optional string field16792 = 10;
+ optional .benchmarks.google_message3.Enum16738 field16793 = 11;
+ optional int32 field16794 = 12;
+ repeated .benchmarks.google_message3.Message16722 field16795 = 13;
+ optional bool field16796 = 19;
+ optional bool field16797 = 24;
+ optional string field16798 = 14;
+ optional int64 field16799 = 15;
+ optional bool field16800 = 16;
+ optional string field16801 = 17;
+ optional .benchmarks.google_message3.Enum16698 field16802 = 18;
+ optional .benchmarks.google_message3.Message16724 field16803 = 20;
+ optional bool field16804 = 22;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field16805 = 25;
+ extensions 1000 to 536870911;
+}
+
+message Message16725 {
+ optional .benchmarks.google_message3.Enum16728 field16774 = 1;
+ repeated string field16775 = 2;
+}
+
+message Message17726 {
+ optional string field17801 = 1;
+ repeated string field17802 = 2;
+ optional string field17803 = 3;
+ repeated string field17804 = 4;
+ optional string field17805 = 5;
+ repeated string field17806 = 6;
+ optional string field17807 = 7;
+ optional string field17808 = 8;
+ repeated string field17809 = 15;
+ repeated string field17810 = 16;
+ repeated string field17811 = 17;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field17812 = 18;
+ optional string field17813 = 9;
+ optional string field17814 = 10;
+ optional string field17815 = 11;
+ optional string field17816 = 12;
+ optional string field17817 = 13;
+ optional string field17818 = 14;
+ optional string field17819 = 19;
+ repeated .benchmarks.google_message3.Message17728 field17820 = 20;
+ repeated .benchmarks.google_message3.Message17728 field17821 = 21;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field17822 = 30;
+}
+
+message Message17782 {
+ optional string field18153 = 1;
+ optional string field18154 = 2;
+}
+
+message Message17783 {
+ optional string field18155 = 1;
+ optional string field18156 = 2;
+ optional string field18157 = 3;
+ repeated group Message17784 = 4 {
+ optional string field18162 = 5;
+ optional string field18163 = 6;
+ optional string field18164 = 7;
+ repeated string field18165 = 8;
+ optional string field18166 = 17;
+ optional string field18167 = 18;
+ }
+ repeated group Message17785 = 9 {
+ optional string field18168 = 10;
+ optional string field18169 = 11;
+ optional .benchmarks.google_message3.Message17783 field18170 = 12;
+ optional string field18171 = 13;
+ optional string field18172 = 14;
+ repeated string field18173 = 15;
+ }
+ repeated string field18160 = 16;
+}
+
+message Message16945 {
+ optional string field16946 = 1;
+ optional string field16947 = 2;
+ optional string field16948 = 3;
+ optional string field16949 = 4;
+ optional string field16950 = 5;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field16951 = 872;
+ repeated .benchmarks.google_message3.Message0 field16952 = 16;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16953 = 54;
+ repeated .benchmarks.google_message3.Message0 field16954 = 55;
+ repeated string field16955 = 58;
+ repeated string field16956 = 59;
+ repeated string field16957 = 62;
+ repeated string field16958 = 37;
+ repeated string field16959 = 18;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16960 = 38;
+ repeated .benchmarks.google_message3.Message0 field16961 = 67;
+ repeated .benchmarks.google_message3.Message0 field16962 = 130;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16963 = 136;
+ repeated string field16964 = 138;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16965 = 156;
+ repeated string field16966 = 139;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16967 = 126;
+ repeated string field16968 = 152;
+ repeated .benchmarks.google_message3.Message0 field16969 = 183;
+ repeated string field16970 = 168;
+ repeated string field16971 = 212;
+ repeated string field16972 = 213;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16973 = 189;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16974 = 190;
+ repeated string field16975 = 191;
+ repeated string field16976 = 192;
+ repeated .benchmarks.google_message3.Message0 field16977 = 193;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16978 = 194;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16979 = 195;
+ repeated int32 field16980 = 196;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16981 = 95;
+ repeated string field16982 = 96;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16983 = 97;
+ repeated string field16984 = 1086;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16985 = 98;
+ repeated string field16986 = 99;
+ repeated string field16987 = 100;
+ repeated string field16988 = 48;
+ optional string field16989 = 22;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field16990 = 51;
+ repeated string field16991 = 81;
+ repeated string field16992 = 85;
+ repeated string field16993 = 169;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field16994 = 260;
+ optional int32 field16995 = 198;
+ optional int32 field16996 = 204;
+ optional string field16997 = 1087;
+ repeated string field16998 = 197;
+ repeated string field16999 = 206;
+ optional string field17000 = 211;
+ repeated string field17001 = 205;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field17002 = 68;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field17003 = 69;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field17004 = 70;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field17005 = 71;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field17006 = 72;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field17007 = 19;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field17008 = 24;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field17009 = 23;
+ repeated .benchmarks.google_message3.Message0 field17010 = 131;
+ repeated string field17011 = 133;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field17012 = 142;
+ repeated string field17013 = 143;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field17014 = 153;
+ repeated .benchmarks.google_message3.Message0 field17015 = 170;
+ repeated string field17016 = 171;
+ repeated string field17017 = 172;
+ repeated string field17018 = 173;
+ repeated string field17019 = 174;
+ repeated string field17020 = 175;
+ repeated string field17021 = 186;
+ repeated string field17022 = 101;
+ repeated .benchmarks.google_message3.Message0 field17023 = 102;
+ repeated string field17024 = 274;
+ extensions 17 to 17;
+ extensions 21 to 21;
+ extensions 25 to 25;
+ extensions 27 to 27;
+ extensions 29 to 29;
+ extensions 30 to 30;
+ extensions 31 to 31;
+ extensions 32 to 32;
+ extensions 33 to 33;
+ extensions 34 to 34;
+ extensions 35 to 35;
+ extensions 36 to 36;
+ extensions 39 to 39;
+ extensions 40 to 40;
+ extensions 41 to 41;
+ extensions 42 to 42;
+ extensions 43 to 43;
+ extensions 44 to 44;
+ extensions 45 to 45;
+ extensions 46 to 46;
+ extensions 47 to 47;
+ extensions 49 to 49;
+ extensions 50 to 50;
+ extensions 52 to 52;
+ extensions 53 to 53;
+ extensions 56 to 56;
+ extensions 57 to 57;
+ extensions 60 to 60;
+ extensions 61 to 61;
+ extensions 63 to 63;
+ extensions 64 to 64;
+ extensions 65 to 65;
+ extensions 66 to 66;
+ extensions 73 to 73;
+ extensions 74 to 74;
+ extensions 75 to 75;
+ extensions 76 to 76;
+ extensions 77 to 77;
+ extensions 78 to 78;
+ extensions 79 to 79;
+ extensions 80 to 80;
+ extensions 82 to 82;
+ extensions 83 to 83;
+ extensions 84 to 84;
+ extensions 86 to 86;
+ extensions 87 to 87;
+ extensions 88 to 88;
+ extensions 89 to 89;
+ extensions 90 to 90;
+ extensions 91 to 91;
+ extensions 92 to 92;
+ extensions 93 to 93;
+ extensions 94 to 94;
+ extensions 103 to 103;
+ extensions 104 to 104;
+ extensions 105 to 105;
+ extensions 106 to 106;
+ extensions 107 to 107;
+ extensions 108 to 108;
+ extensions 109 to 109;
+ extensions 110 to 110;
+ extensions 111 to 111;
+ extensions 112 to 112;
+ extensions 113 to 113;
+ extensions 114 to 114;
+ extensions 115 to 115;
+ extensions 116 to 116;
+ extensions 117 to 117;
+ extensions 118 to 118;
+ extensions 119 to 119;
+ extensions 120 to 120;
+ extensions 121 to 121;
+ extensions 122 to 122;
+ extensions 123 to 123;
+ extensions 124 to 124;
+ extensions 125 to 125;
+ extensions 127 to 127;
+ extensions 128 to 128;
+ extensions 129 to 129;
+ extensions 132 to 132;
+ extensions 134 to 134;
+ extensions 135 to 135;
+ extensions 137 to 137;
+ extensions 140 to 140;
+ extensions 141 to 141;
+ extensions 144 to 144;
+ extensions 145 to 145;
+ extensions 146 to 146;
+ extensions 147 to 147;
+ extensions 148 to 148;
+ extensions 149 to 149;
+ extensions 150 to 150;
+ extensions 151 to 151;
+ extensions 154 to 154;
+ extensions 155 to 155;
+ extensions 157 to 157;
+ extensions 158 to 158;
+ extensions 159 to 159;
+ extensions 160 to 160;
+ extensions 161 to 161;
+ extensions 162 to 162;
+ extensions 163 to 163;
+ extensions 164 to 164;
+ extensions 165 to 165;
+ extensions 166 to 166;
+ extensions 167 to 167;
+ extensions 176 to 176;
+ extensions 177 to 177;
+ extensions 178 to 178;
+ extensions 179 to 179;
+ extensions 180 to 180;
+ extensions 181 to 181;
+ extensions 182 to 182;
+ extensions 184 to 184;
+ extensions 185 to 185;
+ extensions 187 to 187;
+ extensions 188 to 188;
+ extensions 199 to 199;
+ extensions 200 to 200;
+ extensions 201 to 201;
+ extensions 202 to 202;
+ extensions 203 to 203;
+ extensions 207 to 207;
+ extensions 208 to 208;
+ extensions 209 to 209;
+ extensions 210 to 210;
+ extensions 214 to 214;
+ extensions 215 to 215;
+ extensions 216 to 216;
+ extensions 217 to 217;
+ extensions 218 to 218;
+ extensions 219 to 219;
+ extensions 220 to 220;
+ extensions 221 to 221;
+ extensions 222 to 222;
+ extensions 223 to 223;
+ extensions 224 to 224;
+ extensions 225 to 225;
+ extensions 226 to 226;
+ extensions 227 to 227;
+ extensions 228 to 228;
+ extensions 229 to 229;
+ extensions 230 to 230;
+ extensions 231 to 231;
+ extensions 232 to 232;
+ extensions 233 to 233;
+ extensions 234 to 234;
+ extensions 235 to 235;
+ extensions 236 to 236;
+ extensions 237 to 237;
+ extensions 238 to 238;
+ extensions 239 to 239;
+ extensions 240 to 240;
+ extensions 241 to 241;
+ extensions 242 to 242;
+ extensions 243 to 243;
+ extensions 244 to 244;
+ extensions 245 to 245;
+ extensions 246 to 246;
+ extensions 247 to 247;
+ extensions 248 to 248;
+ extensions 249 to 249;
+ extensions 250 to 250;
+ extensions 251 to 251;
+ extensions 252 to 252;
+ extensions 253 to 253;
+ extensions 254 to 254;
+ extensions 255 to 255;
+ extensions 256 to 256;
+ extensions 257 to 257;
+ extensions 258 to 258;
+ extensions 259 to 259;
+ extensions 261 to 261;
+ extensions 262 to 262;
+ extensions 263 to 263;
+ extensions 264 to 264;
+ extensions 265 to 265;
+ extensions 266 to 266;
+ extensions 267 to 267;
+ extensions 268 to 268;
+ extensions 269 to 269;
+ extensions 270 to 270;
+ extensions 271 to 271;
+ extensions 272 to 272;
+ extensions 273 to 273;
+ extensions 275 to 275;
+ extensions 276 to 276;
+ extensions 277 to 277;
+ extensions 278 to 278;
+ extensions 279 to 279;
+ extensions 280 to 280;
+ extensions 281 to 281;
+ extensions 282 to 282;
+ extensions 283 to 283;
+ extensions 284 to 284;
+ extensions 285 to 285;
+ extensions 286 to 286;
+ extensions 290 to 290;
+ extensions 291 to 291;
+ extensions 292 to 292;
+ extensions 293 to 293;
+ extensions 294 to 294;
+ extensions 295 to 295;
+ extensions 296 to 296;
+ extensions 297 to 297;
+ extensions 298 to 298;
+ extensions 299 to 299;
+ extensions 300 to 300;
+ extensions 301 to 301;
+ extensions 302 to 302;
+ extensions 303 to 303;
+ extensions 304 to 304;
+ extensions 305 to 305;
+ extensions 306 to 306;
+ extensions 307 to 307;
+ extensions 308 to 308;
+ extensions 309 to 309;
+ extensions 310 to 310;
+ extensions 311 to 311;
+ extensions 312 to 312;
+ extensions 313 to 313;
+ extensions 314 to 314;
+ extensions 315 to 315;
+ extensions 316 to 316;
+ extensions 317 to 317;
+ extensions 318 to 318;
+ extensions 319 to 319;
+ extensions 320 to 320;
+ extensions 321 to 321;
+ extensions 322 to 322;
+ extensions 323 to 323;
+ extensions 324 to 324;
+ extensions 325 to 325;
+ extensions 326 to 326;
+ extensions 327 to 327;
+ extensions 328 to 328;
+ extensions 329 to 329;
+ extensions 330 to 330;
+ extensions 331 to 331;
+ extensions 332 to 332;
+ extensions 333 to 333;
+ extensions 334 to 334;
+ extensions 335 to 335;
+ extensions 336 to 336;
+ extensions 337 to 337;
+ extensions 338 to 338;
+ extensions 339 to 339;
+ extensions 340 to 340;
+ extensions 341 to 341;
+ extensions 342 to 342;
+ extensions 343 to 343;
+ extensions 344 to 344;
+ extensions 345 to 345;
+ extensions 346 to 346;
+ extensions 347 to 347;
+ extensions 348 to 348;
+ extensions 349 to 349;
+ extensions 350 to 350;
+ extensions 351 to 351;
+ extensions 352 to 352;
+ extensions 353 to 353;
+ extensions 354 to 354;
+ extensions 355 to 355;
+ extensions 356 to 356;
+ extensions 357 to 357;
+ extensions 358 to 358;
+ extensions 359 to 359;
+ extensions 360 to 360;
+ extensions 361 to 361;
+ extensions 362 to 362;
+ extensions 363 to 363;
+ extensions 364 to 364;
+ extensions 365 to 365;
+ extensions 366 to 366;
+ extensions 367 to 367;
+ extensions 368 to 368;
+ extensions 369 to 369;
+ extensions 370 to 370;
+ extensions 371 to 371;
+ extensions 372 to 372;
+ extensions 373 to 373;
+ extensions 374 to 374;
+ extensions 375 to 375;
+ extensions 376 to 376;
+ extensions 377 to 377;
+ extensions 378 to 378;
+ extensions 379 to 379;
+ extensions 380 to 380;
+ extensions 381 to 381;
+ extensions 382 to 382;
+ extensions 383 to 383;
+ extensions 384 to 384;
+ extensions 385 to 385;
+ extensions 386 to 386;
+ extensions 387 to 387;
+ extensions 388 to 388;
+ extensions 389 to 389;
+ extensions 390 to 390;
+ extensions 391 to 391;
+ extensions 392 to 392;
+ extensions 393 to 393;
+ extensions 394 to 394;
+ extensions 395 to 395;
+ extensions 396 to 396;
+ extensions 397 to 397;
+ extensions 398 to 398;
+ extensions 399 to 399;
+ extensions 400 to 400;
+ extensions 401 to 401;
+ extensions 402 to 402;
+ extensions 403 to 403;
+ extensions 404 to 404;
+ extensions 405 to 405;
+ extensions 406 to 406;
+ extensions 407 to 407;
+ extensions 408 to 408;
+ extensions 409 to 409;
+ extensions 410 to 410;
+ extensions 411 to 411;
+ extensions 412 to 412;
+ extensions 413 to 413;
+ extensions 414 to 414;
+ extensions 415 to 415;
+ extensions 416 to 416;
+ extensions 417 to 417;
+ extensions 418 to 418;
+ extensions 419 to 419;
+ extensions 420 to 420;
+ extensions 421 to 421;
+ extensions 422 to 422;
+ extensions 423 to 423;
+ extensions 424 to 424;
+ extensions 425 to 425;
+ extensions 426 to 426;
+ extensions 427 to 427;
+ extensions 428 to 428;
+ extensions 429 to 429;
+ extensions 430 to 430;
+ extensions 431 to 431;
+ extensions 432 to 432;
+ extensions 433 to 433;
+ extensions 434 to 434;
+ extensions 435 to 435;
+ extensions 436 to 436;
+ extensions 437 to 437;
+ extensions 438 to 438;
+ extensions 439 to 439;
+ extensions 440 to 440;
+ extensions 441 to 441;
+ extensions 442 to 442;
+ extensions 443 to 443;
+ extensions 444 to 444;
+ extensions 445 to 445;
+ extensions 446 to 446;
+ extensions 447 to 447;
+ extensions 448 to 448;
+ extensions 449 to 449;
+ extensions 450 to 450;
+ extensions 451 to 451;
+ extensions 452 to 452;
+ extensions 453 to 453;
+ extensions 454 to 454;
+ extensions 455 to 455;
+ extensions 456 to 456;
+ extensions 457 to 457;
+ extensions 458 to 458;
+ extensions 459 to 459;
+ extensions 460 to 460;
+ extensions 461 to 461;
+ extensions 462 to 462;
+ extensions 463 to 463;
+ extensions 464 to 464;
+ extensions 465 to 465;
+ extensions 466 to 466;
+ extensions 467 to 467;
+ extensions 468 to 468;
+ extensions 469 to 469;
+ extensions 470 to 470;
+ extensions 471 to 471;
+ extensions 472 to 472;
+ extensions 473 to 473;
+ extensions 474 to 474;
+ extensions 509 to 509;
+ extensions 511 to 511;
+ extensions 512 to 512;
+ extensions 513 to 513;
+ extensions 514 to 514;
+ extensions 515 to 515;
+ extensions 516 to 516;
+ extensions 517 to 517;
+ extensions 518 to 518;
+ extensions 519 to 519;
+ extensions 520 to 520;
+ extensions 521 to 521;
+ extensions 522 to 522;
+ extensions 523 to 523;
+ extensions 524 to 524;
+ extensions 525 to 525;
+ extensions 526 to 526;
+ extensions 527 to 527;
+ extensions 528 to 528;
+ extensions 529 to 529;
+ extensions 530 to 530;
+ extensions 531 to 531;
+ extensions 532 to 532;
+ extensions 533 to 533;
+ extensions 534 to 534;
+ extensions 535 to 535;
+ extensions 536 to 536;
+ extensions 537 to 537;
+ extensions 538 to 538;
+ extensions 539 to 539;
+ extensions 540 to 540;
+ extensions 541 to 541;
+ extensions 542 to 542;
+ extensions 543 to 543;
+ extensions 544 to 544;
+ extensions 545 to 545;
+ extensions 546 to 546;
+ extensions 547 to 547;
+ extensions 548 to 548;
+ extensions 549 to 549;
+ extensions 550 to 550;
+ extensions 551 to 551;
+ extensions 552 to 552;
+ extensions 553 to 553;
+ extensions 554 to 554;
+ extensions 555 to 555;
+ extensions 556 to 556;
+ extensions 557 to 557;
+ extensions 558 to 558;
+ extensions 559 to 559;
+ extensions 560 to 560;
+ extensions 561 to 561;
+ extensions 562 to 562;
+ extensions 563 to 563;
+ extensions 564 to 564;
+ extensions 565 to 565;
+ extensions 566 to 566;
+ extensions 567 to 567;
+ extensions 568 to 568;
+ extensions 569 to 569;
+ extensions 570 to 570;
+ extensions 571 to 571;
+ extensions 572 to 572;
+ extensions 573 to 573;
+ extensions 574 to 574;
+ extensions 575 to 575;
+ extensions 576 to 576;
+ extensions 577 to 577;
+ extensions 578 to 578;
+ extensions 579 to 579;
+ extensions 580 to 580;
+ extensions 581 to 581;
+ extensions 582 to 582;
+ extensions 583 to 583;
+ extensions 584 to 584;
+ extensions 585 to 585;
+ extensions 586 to 586;
+ extensions 587 to 587;
+ extensions 588 to 588;
+ extensions 589 to 589;
+ extensions 590 to 590;
+ extensions 604 to 604;
+ extensions 605 to 605;
+ extensions 606 to 606;
+ extensions 607 to 607;
+ extensions 608 to 608;
+ extensions 609 to 609;
+ extensions 610 to 610;
+ extensions 611 to 611;
+ extensions 612 to 612;
+ extensions 613 to 613;
+ extensions 614 to 614;
+ extensions 615 to 615;
+ extensions 616 to 616;
+ extensions 617 to 617;
+ extensions 618 to 618;
+ extensions 619 to 619;
+ extensions 620 to 620;
+ extensions 621 to 621;
+ extensions 622 to 622;
+ extensions 623 to 623;
+ extensions 624 to 624;
+ extensions 625 to 625;
+ extensions 626 to 626;
+ extensions 627 to 627;
+ extensions 628 to 628;
+ extensions 629 to 629;
+ extensions 813 to 813;
+ extensions 814 to 814;
+ extensions 815 to 815;
+ extensions 816 to 816;
+ extensions 817 to 817;
+ extensions 818 to 818;
+ extensions 819 to 819;
+ extensions 820 to 820;
+ extensions 821 to 821;
+ extensions 822 to 822;
+ extensions 823 to 823;
+ extensions 824 to 824;
+ extensions 827 to 827;
+ extensions 828 to 828;
+ extensions 829 to 829;
+ extensions 830 to 830;
+ extensions 831 to 831;
+ extensions 832 to 832;
+ extensions 833 to 833;
+ extensions 834 to 834;
+ extensions 835 to 835;
+ extensions 836 to 836;
+ extensions 837 to 837;
+ extensions 838 to 838;
+ extensions 839 to 839;
+ extensions 840 to 840;
+ extensions 841 to 841;
+ extensions 842 to 842;
+ extensions 843 to 843;
+ extensions 844 to 844;
+ extensions 845 to 845;
+ extensions 846 to 846;
+ extensions 847 to 847;
+ extensions 848 to 848;
+ extensions 849 to 849;
+ extensions 850 to 850;
+ extensions 851 to 851;
+ extensions 852 to 852;
+ extensions 853 to 853;
+ extensions 854 to 854;
+ extensions 855 to 855;
+ extensions 856 to 856;
+ extensions 857 to 857;
+ extensions 858 to 858;
+ extensions 859 to 859;
+ extensions 860 to 860;
+ extensions 861 to 861;
+ extensions 862 to 862;
+ extensions 863 to 863;
+ extensions 864 to 864;
+ extensions 865 to 865;
+ extensions 866 to 866;
+ extensions 867 to 867;
+ extensions 868 to 868;
+ extensions 869 to 869;
+ extensions 870 to 870;
+ extensions 871 to 871;
+ extensions 880 to 880;
+ extensions 881 to 881;
+ extensions 882 to 882;
+ extensions 883 to 883;
+ extensions 884 to 884;
+ extensions 885 to 885;
+ extensions 886 to 886;
+ extensions 887 to 887;
+ extensions 888 to 888;
+ extensions 890 to 890;
+ extensions 891 to 891;
+ extensions 892 to 892;
+ extensions 912 to 912;
+ extensions 914 to 914;
+ extensions 915 to 915;
+ extensions 916 to 916;
+ extensions 917 to 917;
+ extensions 918 to 918;
+ extensions 919 to 919;
+ extensions 920 to 920;
+ extensions 921 to 921;
+ extensions 922 to 922;
+ extensions 923 to 923;
+ extensions 924 to 924;
+ extensions 925 to 925;
+ extensions 926 to 926;
+ extensions 927 to 927;
+ extensions 928 to 928;
+ extensions 929 to 929;
+ extensions 930 to 930;
+ extensions 931 to 931;
+ extensions 932 to 932;
+ extensions 933 to 933;
+ extensions 934 to 934;
+ extensions 935 to 935;
+ extensions 936 to 936;
+ extensions 937 to 937;
+ extensions 938 to 938;
+ extensions 939 to 939;
+ extensions 940 to 940;
+ extensions 941 to 941;
+ extensions 942 to 942;
+ extensions 943 to 943;
+ extensions 944 to 944;
+ extensions 945 to 945;
+ extensions 946 to 946;
+ extensions 947 to 947;
+ extensions 949 to 949;
+ extensions 950 to 950;
+ extensions 951 to 951;
+ extensions 952 to 952;
+ extensions 954 to 954;
+ extensions 955 to 955;
+ extensions 956 to 956;
+ extensions 957 to 957;
+ extensions 958 to 958;
+ extensions 959 to 959;
+ extensions 960 to 960;
+ extensions 961 to 961;
+ extensions 962 to 962;
+ extensions 963 to 963;
+ extensions 964 to 964;
+ extensions 965 to 965;
+ extensions 966 to 966;
+ extensions 967 to 967;
+ extensions 968 to 968;
+ extensions 969 to 969;
+ extensions 970 to 970;
+ extensions 971 to 971;
+ extensions 972 to 972;
+ extensions 973 to 973;
+ extensions 974 to 974;
+ extensions 975 to 975;
+ extensions 976 to 976;
+ extensions 977 to 977;
+ extensions 978 to 978;
+ extensions 979 to 979;
+ extensions 980 to 980;
+ extensions 981 to 981;
+ extensions 982 to 982;
+ extensions 983 to 983;
+ extensions 984 to 984;
+ extensions 985 to 985;
+ extensions 987 to 987;
+ extensions 988 to 988;
+ extensions 1000 to 1000;
+ extensions 1001 to 1001;
+ extensions 1002 to 1002;
+ extensions 1003 to 1003;
+ extensions 1004 to 1004;
+ extensions 1005 to 1005;
+ extensions 1006 to 1006;
+ extensions 1007 to 1007;
+ extensions 1008 to 1008;
+ extensions 1009 to 1009;
+ extensions 1010 to 1010;
+ extensions 1011 to 1011;
+ extensions 1012 to 1012;
+ extensions 1013 to 1013;
+ extensions 1014 to 1014;
+ extensions 1015 to 1015;
+ extensions 1016 to 1016;
+ extensions 1017 to 1017;
+ extensions 1018 to 1018;
+ extensions 1019 to 1019;
+ extensions 1020 to 1020;
+ extensions 1021 to 1021;
+ extensions 1022 to 1022;
+ extensions 1023 to 1023;
+ extensions 1024 to 1024;
+ extensions 1025 to 1025;
+ extensions 1026 to 1026;
+ extensions 1027 to 1027;
+ extensions 1028 to 1028;
+ extensions 1029 to 1029;
+ extensions 1030 to 1030;
+ extensions 1031 to 1031;
+ extensions 1032 to 1032;
+ extensions 1033 to 1033;
+ extensions 1034 to 1034;
+ extensions 1035 to 1035;
+ extensions 1036 to 1036;
+ extensions 1037 to 1037;
+ extensions 1038 to 1038;
+ extensions 1039 to 1039;
+ extensions 1040 to 1040;
+ extensions 1041 to 1041;
+ extensions 1042 to 1042;
+ extensions 1043 to 1043;
+ extensions 1044 to 1044;
+ extensions 1045 to 1045;
+ extensions 1046 to 1046;
+ extensions 1047 to 1047;
+ extensions 1048 to 1048;
+ extensions 1049 to 1049;
+ extensions 1050 to 1050;
+ extensions 1051 to 1051;
+ extensions 1052 to 1052;
+ extensions 1053 to 1053;
+ extensions 1054 to 1054;
+ extensions 1055 to 1055;
+ extensions 1056 to 1056;
+ extensions 1057 to 1057;
+ extensions 1058 to 1058;
+ extensions 1079 to 1079;
+ extensions 1080 to 1080;
+ extensions 1081 to 1081;
+ extensions 1082 to 1082;
+ extensions 1083 to 1083;
+ extensions 1084 to 1084;
+ extensions 1085 to 1085;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message16945 field17025 = 22068132;
+ }
+}
+
diff --git a/benchmarks/datasets/google_message3/benchmark_message3_2.proto b/benchmarks/datasets/google_message3/benchmark_message3_2.proto
new file mode 100644
index 00000000..2cb54658
--- /dev/null
+++ b/benchmarks/datasets/google_message3/benchmark_message3_2.proto
@@ -0,0 +1,498 @@
+syntax = "proto2";
+
+import "datasets/google_message3/benchmark_message3_3.proto";
+import "datasets/google_message3/benchmark_message3_4.proto";
+import "datasets/google_message3/benchmark_message3_5.proto";
+import "datasets/google_message3/benchmark_message3_7.proto";
+import "datasets/google_message3/benchmark_message3_8.proto";
+package benchmarks.google_message3;
+
+option cc_enable_arenas = true;
+
+message Message22853 {
+ optional .benchmarks.google_message3.Enum22854 field22869 = 1;
+ repeated uint32 field22870 = 2 [packed = true];
+ repeated float field22871 = 3 [packed = true];
+ repeated float field22872 = 5 [packed = true];
+ optional .benchmarks.google_message3.UnusedEmptyMessage field22873 = 4;
+}
+
+message Message24345 {
+ optional string field24533 = 1;
+ optional .benchmarks.google_message3.UnusedEnum field24534 = 22;
+ optional .benchmarks.google_message3.Message24346 field24535 = 2;
+ optional string field24536 = 3;
+ optional string field24537 = 4;
+ optional .benchmarks.google_message3.UnusedEnum field24538 = 23;
+ optional string field24539 = 5;
+ required string field24540 = 6;
+ optional string field24541 = 7;
+ optional string field24542 = 8;
+ optional .benchmarks.google_message3.Message24316 field24543 = 9;
+ optional .benchmarks.google_message3.Message24376 field24544 = 10;
+ optional string field24545 = 11;
+ optional string field24546 = 19;
+ optional string field24547 = 20;
+ optional string field24548 = 21;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24549 = 12;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24550 = 13;
+ repeated string field24551 = 14;
+ optional string field24552 = 15;
+ optional int32 field24553 = 18;
+ optional .benchmarks.google_message3.Message24379 field24554 = 16;
+ optional string field24555 = 17;
+ repeated .benchmarks.google_message3.Message24356 field24556 = 24;
+ repeated .benchmarks.google_message3.Message24366 field24557 = 25;
+}
+
+message Message24403 {
+ optional .benchmarks.google_message3.Message24401 field24681 = 1;
+ optional .benchmarks.google_message3.Message24402 field24682 = 2;
+}
+
+message Message24391 {
+ optional string field24631 = 1;
+ optional string field24632 = 2;
+ repeated string field24633 = 3;
+ optional string field24634 = 4;
+ repeated string field24635 = 5;
+ repeated string field24636 = 16;
+ optional string field24637 = 17;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24638 = 25;
+ optional string field24639 = 7;
+ optional string field24640 = 18;
+ optional string field24641 = 19;
+ optional string field24642 = 20;
+ optional int32 field24643 = 24;
+ optional .benchmarks.google_message3.Message24379 field24644 = 8;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field24645 = 9;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24646 = 10;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24647 = 11;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24648 = 12;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field24649 = 13;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24650 = 14;
+ optional string field24651 = 21;
+ optional int32 field24652 = 22;
+ optional int32 field24653 = 23;
+ repeated string field24654 = 15;
+ repeated string field24655 = 6;
+}
+
+message Message27454 {
+}
+
+message Message27357 {
+ optional string field27410 = 1;
+ optional float field27411 = 2;
+ optional string field27412 = 3;
+ optional bool field27413 = 4;
+ optional bool field27414 = 5;
+}
+
+message Message27360 {
+ optional .benchmarks.google_message3.Message27358 field27426 = 1;
+ optional .benchmarks.google_message3.Enum27361 field27427 = 2;
+ optional .benchmarks.google_message3.Message27358 field27428 = 3;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field27429 = 4;
+}
+
+message Message34387 {
+ optional string field34446 = 1;
+ repeated .benchmarks.google_message3.Message34381 field34447 = 2;
+ optional .benchmarks.google_message3.UnusedEnum field34448 = 3;
+ optional .benchmarks.google_message3.Enum34388 field34449 = 4;
+ optional int64 field34450 = 5;
+}
+
+message Message34621 {
+ optional double field34651 = 1;
+ optional double field34652 = 2;
+ optional double field34653 = 3;
+ optional double field34654 = 4;
+ optional double field34655 = 11;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field34656 = 13;
+ optional .benchmarks.google_message3.Message34619 field34657 = 14;
+ optional string field34658 = 5;
+ optional string field34659 = 9;
+ optional double field34660 = 12;
+ optional bytes field34661 = 19;
+ optional string field34662 = 15;
+ optional string field34663 = 16;
+ optional string field34664 = 17;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field34665 = 18;
+ optional .benchmarks.google_message3.Message34621 field34666 = 20;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field34667 = 100;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field34668 = 101;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message34621 field34669 = 17562023;
+ }
+}
+
+message Message35476 {
+ optional string field35484 = 1;
+ optional string field35485 = 2;
+ optional string field35486 = 3;
+ optional .benchmarks.google_message3.Enum35477 field35487 = 4;
+ optional float field35488 = 5;
+ optional float field35489 = 6;
+ optional float field35490 = 7;
+ optional float field35491 = 8;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field35492 = 9;
+ optional int32 field35493 = 10;
+ optional int32 field35494 = 11;
+ optional int32 field35495 = 12;
+ optional string field35496 = 13;
+ optional string field35497 = 14;
+}
+
+message Message949 {
+ optional string field955 = 1;
+ optional int64 field956 = 2;
+ optional int64 field957 = 3;
+ optional .benchmarks.google_message3.Message730 field958 = 4;
+ repeated string field959 = 5;
+ optional string field960 = 6;
+ optional bool field961 = 7;
+}
+
+message Message36869 {
+ optional int32 field36970 = 1;
+ optional int32 field36971 = 2;
+}
+
+message Message33968 {
+ repeated group Message33969 = 1 {
+ }
+ repeated .benchmarks.google_message3.Message33958 field33989 = 3;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field33990 = 106;
+ optional bool field33991 = 108;
+ optional .benchmarks.google_message3.UnusedEnum field33992 = 107;
+}
+
+message Message6644 {
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6701 = 8;
+ optional string field6702 = 1;
+ optional double field6703 = 2;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6704 = 9;
+ optional bytes field6705 = 3;
+ optional bytes field6706 = 19;
+ optional .benchmarks.google_message3.Message6637 field6707 = 4;
+ repeated .benchmarks.google_message3.Message6126 field6708 = 18;
+ optional bool field6709 = 6;
+ optional .benchmarks.google_message3.Message6643 field6710 = 10;
+ optional string field6711 = 12;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6712 = 14;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6713 = 15;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6714 = 16;
+ optional int32 field6715 = 17;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6716 = 20;
+}
+
+message Message18831 {
+ repeated group Message18832 = 1 {
+ optional int32 field18836 = 2;
+ optional string field18837 = 5;
+ optional float field18838 = 3;
+ optional float field18839 = 9;
+ optional int32 field18840 = 11;
+ repeated uint64 field18841 = 4;
+ repeated group Message18833 = 6 {
+ required uint64 field18843 = 7;
+ optional string field18844 = 8;
+ optional float field18845 = 10;
+ optional int32 field18846 = 12;
+ optional bool field18847 = 13;
+ }
+ }
+}
+
+message Message13090 {
+ optional .benchmarks.google_message3.Message13083 field13141 = 1;
+ optional .benchmarks.google_message3.Message13088 field13142 = 2;
+}
+
+message Message11874 {
+ optional .benchmarks.google_message3.Message10391 field11888 = 3;
+ optional string field11889 = 4;
+ optional .benchmarks.google_message3.Message11873 field11890 = 6;
+ optional bool field11891 = 7;
+ extensions 1 to 1;
+ extensions 2 to 2;
+ extensions 5 to 5;
+}
+
+message Message4144 {
+ repeated group Message4145 = 1 {
+ required .benchmarks.google_message3.Enum4146 field4165 = 2;
+ required int32 field4166 = 3;
+ optional .benchmarks.google_message3.Enum4160 field4167 = 9;
+ optional bytes field4168 = 4;
+ optional .benchmarks.google_message3.Enum4152 field4169 = 5;
+ optional string field4170 = 6;
+ }
+}
+
+message Message35573 {
+ optional fixed64 field35695 = 16;
+ optional string field35696 = 1000;
+ optional string field35697 = 1004;
+ optional int32 field35698 = 1003;
+ repeated group Message35574 = 1012 {
+ }
+ optional int64 field35700 = 1011;
+ optional int64 field35701 = 1005;
+ optional int64 field35702 = 1006;
+ optional int64 field35703 = 1007;
+ optional int64 field35704 = 1008;
+ repeated group Message35575 = 1 {
+ optional int64 field35709 = 2;
+ optional string field35710 = 3;
+ optional string field35711 = 19;
+ optional int32 field35712 = 20;
+ optional int32 field35713 = 21;
+ optional int32 field35714 = 22;
+ optional bool field35715 = 23;
+ optional int32 field35716 = 47;
+ optional int32 field35717 = 48;
+ optional bool field35718 = 24;
+ optional fixed64 field35719 = 25;
+ optional bytes field35720 = 52;
+ optional int32 field35721 = 18;
+ optional fixed32 field35722 = 43;
+ optional bool field35723 = 26;
+ optional int32 field35724 = 27;
+ optional int32 field35725 = 17;
+ optional bool field35726 = 45;
+ repeated int32 field35727 = 33;
+ repeated int32 field35728 = 58;
+ optional float field35729 = 34;
+ optional float field35730 = 1009;
+ optional int32 field35731 = 28;
+ repeated fixed64 field35732 = 1001;
+ repeated fixed64 field35733 = 1002;
+ optional int32 field35734 = 44;
+ optional int32 field35735 = 50;
+ optional int32 field35736 = 36;
+ optional int32 field35737 = 40;
+ optional bool field35738 = 1016;
+ optional bool field35739 = 1010;
+ optional int32 field35740 = 37;
+ optional int32 field35741 = 38;
+ optional string field35742 = 46;
+ optional uint32 field35743 = 60;
+ repeated bytes field35744 = 56;
+ optional .benchmarks.google_message3.Message0 field35745 = 57;
+ required group Message35576 = 4 {
+ optional fixed64 field35747 = 5;
+ optional int32 field35748 = 6;
+ optional int32 field35749 = 49;
+ optional int32 field35750 = 7;
+ optional uint32 field35751 = 59;
+ optional int32 field35752 = 14;
+ optional int32 field35753 = 15;
+ optional int32 field35754 = 35;
+ optional bytes field35755 = 53;
+ optional int32 field35756 = 8;
+ optional string field35757 = 9;
+ optional fixed64 field35758 = 10;
+ optional int32 field35759 = 11;
+ optional int32 field35760 = 12;
+ optional int32 field35761 = 41;
+ optional int32 field35762 = 30;
+ optional int32 field35763 = 31;
+ optional int32 field35764 = 13;
+ optional bytes field35765 = 39;
+ optional string field35766 = 29;
+ optional int32 field35767 = 42;
+ repeated int32 field35768 = 32;
+ repeated int32 field35769 = 51;
+ optional int64 field35770 = 54;
+ optional .benchmarks.google_message3.Message0 field35771 = 55;
+ }
+ }
+}
+
+message Message36858 {
+ repeated int32 field36956 = 1;
+ repeated string field36957 = 2;
+ repeated string field36958 = 12;
+ optional int32 field36959 = 3;
+ optional int32 field36960 = 4;
+ optional int32 field36961 = 14;
+ optional string field36962 = 11;
+ optional bool field36963 = 5;
+ optional bool field36964 = 13;
+ optional int64 field36965 = 6;
+ optional .benchmarks.google_message3.Message35506 field36966 = 7;
+ repeated group Message36859 = 8 {
+ required .benchmarks.google_message3.Enum36860 field36968 = 9;
+ optional float field36969 = 10;
+ }
+}
+
+message Message13174 {
+ required int32 field13237 = 6;
+ optional int32 field13238 = 3;
+ required int32 field13239 = 4;
+ optional int32 field13240 = 8;
+ optional double field13241 = 5;
+ optional double field13242 = 7;
+ optional int32 field13243 = 17;
+ optional int32 field13244 = 19;
+ optional double field13245 = 20;
+ optional int32 field13246 = 9;
+ optional double field13247 = 10;
+ optional int32 field13248 = 11;
+ optional .benchmarks.google_message3.Message13151 field13249 = 21;
+ optional int32 field13250 = 1;
+ optional double field13251 = 2;
+ optional double field13252 = 15;
+ optional double field13253 = 16;
+ optional double field13254 = 12;
+ optional double field13255 = 13;
+ optional double field13256 = 14;
+ optional int32 field13257 = 18;
+}
+
+message Message18283 {
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18478 = 1;
+ optional int32 field18479 = 4;
+ optional int32 field18480 = 106;
+ optional int32 field18481 = 107;
+ optional int32 field18482 = 108;
+ optional int32 field18483 = 109;
+ optional int32 field18484 = 105;
+ optional int32 field18485 = 113;
+ optional int32 field18486 = 114;
+ optional int32 field18487 = 124;
+ optional int32 field18488 = 125;
+ optional int32 field18489 = 128;
+ optional int32 field18490 = 135;
+ optional bool field18491 = 166;
+ optional bool field18492 = 136;
+ optional int32 field18493 = 140;
+ optional int32 field18494 = 171;
+ optional int32 field18495 = 148;
+ optional int32 field18496 = 145;
+ optional float field18497 = 117;
+ optional int32 field18498 = 146;
+ optional string field18499 = 3;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18500 = 5;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18501 = 6;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18502 = 9;
+ optional .benchmarks.google_message3.Message18253 field18503 = 155;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18504 = 184;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18505 = 163;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18506 = 16;
+ repeated int32 field18507 = 20;
+ repeated int32 field18508 = 7;
+ repeated string field18509 = 194;
+ optional bytes field18510 = 30;
+ optional int32 field18511 = 31;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18512 = 178;
+ optional string field18513 = 8;
+ optional float field18514 = 2;
+ optional float field18515 = 100;
+ optional float field18516 = 101;
+ optional float field18517 = 102;
+ optional int32 field18518 = 103;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field18519 = 104;
+ optional int32 field18520 = 110;
+ optional int32 field18521 = 112;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18522 = 111;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18523 = 115;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18524 = 119;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18525 = 127;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18526 = 185;
+ optional int32 field18527 = 120;
+ optional int32 field18528 = 132;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18529 = 126;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18530 = 129;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18531 = 131;
+ optional fixed64 field18532 = 150;
+ optional int32 field18533 = 133;
+ optional int32 field18534 = 134;
+ optional int32 field18535 = 139;
+ optional fixed64 field18536 = 137;
+ optional fixed64 field18537 = 138;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18538 = 141;
+ optional int32 field18539 = 142;
+ optional int32 field18540 = 181;
+ optional .benchmarks.google_message3.Message16816 field18541 = 143;
+ optional .benchmarks.google_message3.Message16685 field18542 = 154;
+ optional int32 field18543 = 144;
+ optional int64 field18544 = 147;
+ optional int64 field18545 = 149;
+ optional int32 field18546 = 151;
+ optional int32 field18547 = 152;
+ optional int32 field18548 = 153;
+ optional float field18549 = 161;
+ optional .benchmarks.google_message3.Message0 field18550 = 123;
+ repeated int64 field18551 = 156;
+ optional int32 field18552 = 157;
+ repeated fixed64 field18553 = 188;
+ optional int32 field18554 = 158;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18555 = 159;
+ optional bool field18556 = 160;
+ optional uint64 field18557 = 162;
+ optional int32 field18558 = 164;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18559 = 10;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18560 = 167;
+ optional int32 field18561 = 168;
+ repeated fixed64 field18562 = 169;
+ repeated string field18563 = 170;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18564 = 172;
+ optional int64 field18565 = 173;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18566 = 174;
+ optional int64 field18567 = 175;
+ optional uint32 field18568 = 189;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18569 = 176;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18570 = 177;
+ optional uint32 field18571 = 179;
+ optional uint32 field18572 = 180;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18573 = 182;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18574 = 183;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18575 = 121;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18576 = 186;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18577 = 187;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18578 = 190;
+ optional int32 field18579 = 191;
+ optional float field18580 = 192;
+ optional bool field18581 = 193;
+ extensions 116 to 116;
+ extensions 118 to 118;
+ extensions 130 to 130;
+ extensions 165 to 165;
+}
+
+message Message13169 {
+ repeated .benchmarks.google_message3.Message13168 field13223 = 1;
+ required .benchmarks.google_message3.Message13167 field13224 = 2;
+ optional string field13225 = 3;
+}
+
+message Message19255 {
+ optional string field19257 = 1;
+}
+
+message Message35542 {
+ optional bool field35543 = 1;
+ optional bool field35544 = 2;
+ optional bool field35545 = 3;
+}
+
+message Message3901 {
+ optional int32 field3990 = 1;
+ optional int32 field3991 = 2;
+ optional int32 field3992 = 3;
+ optional int32 field3993 = 4;
+ optional int32 field3994 = 7;
+ optional int32 field3995 = 8;
+ optional int32 field3996 = 9;
+ optional int32 field3997 = 10;
+ optional int32 field3998 = 11;
+ optional int32 field3999 = 12;
+ optional .benchmarks.google_message3.UnusedEnum field4000 = 6;
+ optional int32 field4001 = 5;
+}
+
diff --git a/benchmarks/datasets/google_message3/benchmark_message3_3.proto b/benchmarks/datasets/google_message3/benchmark_message3_3.proto
new file mode 100644
index 00000000..53426ecf
--- /dev/null
+++ b/benchmarks/datasets/google_message3/benchmark_message3_3.proto
@@ -0,0 +1,465 @@
+syntax = "proto2";
+
+import "datasets/google_message3/benchmark_message3_4.proto";
+import "datasets/google_message3/benchmark_message3_5.proto";
+import "datasets/google_message3/benchmark_message3_7.proto";
+import "datasets/google_message3/benchmark_message3_8.proto";
+package benchmarks.google_message3;
+
+option cc_enable_arenas = true;
+
+message Message35546 {
+ optional int64 field35556 = 1;
+ optional int32 field35557 = 2;
+ optional bool field35558 = 3;
+ optional int64 field35559 = 13;
+ optional group Message35547 = 4 {
+ required int32 field35569 = 5;
+ required int32 field35570 = 6;
+ }
+ optional group Message35548 = 10 {
+ required int64 field35571 = 11;
+ required int64 field35572 = 12;
+ }
+ optional bool field35562 = 14;
+ optional bool field35563 = 15;
+ optional int32 field35564 = 16;
+ optional bool field35565 = 17;
+ optional bool field35566 = 18;
+ optional string field35567 = 100;
+}
+
+message Message2356 {
+ optional .benchmarks.google_message3.Message1374 field2368 = 121;
+ optional uint64 field2369 = 1;
+ optional int32 field2370 = 2;
+ optional int32 field2371 = 17;
+ required string field2372 = 3;
+ optional int32 field2373 = 7;
+ optional bytes field2374 = 8;
+ optional string field2375 = 4;
+ optional string field2376 = 101;
+ optional int32 field2377 = 102;
+ optional int32 field2378 = 103;
+ optional int32 field2379 = 104;
+ optional int32 field2380 = 113;
+ optional int32 field2381 = 114;
+ optional int32 field2382 = 115;
+ optional int32 field2383 = 117;
+ optional int32 field2384 = 118;
+ optional int32 field2385 = 119;
+ optional int32 field2386 = 105;
+ optional bytes field2387 = 5;
+ optional group Message2357 = 6 {
+ optional int64 field2399 = 9;
+ optional int32 field2400 = 10;
+ optional int32 field2401 = 11;
+ optional int32 field2402 = 12;
+ optional int32 field2403 = 13;
+ optional int32 field2404 = 116;
+ optional int32 field2405 = 106;
+ required bytes field2406 = 14;
+ optional int32 field2407 = 45;
+ optional int32 field2408 = 112;
+ optional bool field2409 = 122;
+ optional bytes field2410 = 124;
+ }
+ optional string field2389 = 120;
+ optional group Message2358 = 107 {
+ }
+ repeated group Message2359 = 40 {
+ optional string field2413 = 41;
+ optional string field2414 = 42;
+ optional string field2415 = 43;
+ optional string field2416 = 44;
+ optional int32 field2417 = 46;
+ optional string field2418 = 47;
+ optional float field2419 = 110;
+ optional float field2420 = 111;
+ }
+ optional int32 field2392 = 50;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field2393 = 60;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field2394 = 70;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field2395 = 80;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field2396 = 90;
+ optional string field2397 = 100;
+ optional string field2398 = 123;
+}
+
+message Message7029 {
+ required int32 field7183 = 1;
+ optional int32 field7184 = 2;
+ optional int32 field7185 = 3;
+ optional int32 field7186 = 4;
+ optional int32 field7187 = 5;
+ optional int32 field7188 = 6;
+ optional int32 field7189 = 17;
+ optional int32 field7190 = 18;
+ optional int32 field7191 = 49;
+ optional int32 field7192 = 28;
+ optional int32 field7193 = 33;
+ optional int32 field7194 = 25;
+ optional int32 field7195 = 26;
+ optional int32 field7196 = 40;
+ optional int32 field7197 = 41;
+ optional int32 field7198 = 42;
+ optional int32 field7199 = 43;
+ optional int32 field7200 = 19;
+ optional int32 field7201 = 7;
+ optional int32 field7202 = 8;
+ optional int32 field7203 = 9;
+ optional int32 field7204 = 10;
+ optional int32 field7205 = 11;
+ optional int32 field7206 = 12;
+ repeated group Message7030 = 13 {
+ optional string field7226 = 14;
+ optional string field7227 = 15;
+ optional int64 field7228 = 16;
+ }
+ repeated group Message7031 = 21 {
+ optional string field7229 = 22;
+ optional int32 field7230 = 23;
+ optional int32 field7231 = 24;
+ optional int32 field7232 = 30;
+ optional int32 field7233 = 31;
+ optional int32 field7234 = 35;
+ }
+ optional int32 field7209 = 20;
+ optional float field7210 = 27;
+ optional int32 field7211 = 29;
+ optional int32 field7212 = 32;
+ optional string field7213 = 48;
+ optional bool field7214 = 34;
+ optional int32 field7215 = 36;
+ optional float field7216 = 37;
+ optional bool field7217 = 38;
+ optional bool field7218 = 39;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field7219 = 44;
+ optional int32 field7220 = 45;
+ optional int32 field7221 = 46;
+ optional int32 field7222 = 47;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field7223 = 50;
+ optional int32 field7224 = 51;
+}
+
+message Message35538 {
+ required int64 field35539 = 1;
+}
+
+message Message18921 {
+ optional string field18946 = 1;
+ optional fixed64 field18947 = 2;
+ optional int32 field18948 = 3;
+ optional double field18949 = 4;
+ optional bool field18950 = 17;
+ optional bool field18951 = 23;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18952 = 24;
+ repeated group Message18922 = 5 {
+ optional uint64 field18959 = 6;
+ optional string field18960 = 13;
+ optional bool field18961 = 21;
+ optional bool field18962 = 33;
+ optional int32 field18963 = 7;
+ optional int32 field18964 = 8;
+ optional string field18965 = 9;
+ optional .benchmarks.google_message3.Message18856 field18966 = 10;
+ optional uint64 field18967 = 34;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18968 = 11;
+ optional uint64 field18969 = 35;
+ optional float field18970 = 12;
+ repeated string field18971 = 14;
+ optional bool field18972 = 15;
+ optional bool field18973 = 16;
+ optional float field18974 = 22;
+ optional int32 field18975 = 18;
+ optional int32 field18976 = 19;
+ optional int32 field18977 = 20;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field18978 = 25;
+ optional .benchmarks.google_message3.UnusedEnum field18979 = 26;
+ repeated string field18980 = 27;
+ optional float field18981 = 28;
+ }
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field18954 = 29;
+ repeated .benchmarks.google_message3.Message18943 field18955 = 30;
+ repeated .benchmarks.google_message3.Message18944 field18956 = 31;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field18957 = 32;
+}
+
+message Message35540 {
+ optional bool field35541 = 1;
+}
+
+message Message3886 {
+ repeated group Message3887 = 1 {
+ required string field3932 = 2;
+ optional string field3933 = 9;
+ optional .benchmarks.google_message3.Message3850 field3934 = 3;
+ optional bytes field3935 = 8;
+ }
+}
+
+message Message6743 {
+ optional .benchmarks.google_message3.Message6721 field6759 = 1;
+ optional .benchmarks.google_message3.Message6723 field6760 = 2;
+ optional .benchmarks.google_message3.Message6723 field6761 = 8;
+ optional .benchmarks.google_message3.Message6725 field6762 = 3;
+ optional .benchmarks.google_message3.Message6726 field6763 = 4;
+ optional .benchmarks.google_message3.Message6733 field6764 = 5;
+ optional .benchmarks.google_message3.Message6734 field6765 = 6;
+ optional .benchmarks.google_message3.Message6742 field6766 = 7;
+}
+
+message Message6773 {
+ optional .benchmarks.google_message3.Enum6769 field6794 = 1;
+ optional int32 field6795 = 9;
+ optional .benchmarks.google_message3.UnusedEnum field6796 = 10;
+ optional int32 field6797 = 11;
+ optional int32 field6798 = 2;
+ optional .benchmarks.google_message3.Enum6774 field6799 = 3;
+ optional double field6800 = 5;
+ optional double field6801 = 7;
+ optional double field6802 = 8;
+ optional .benchmarks.google_message3.Enum6782 field6803 = 6;
+}
+
+message Message8224 {
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8255 = 1;
+ optional .benchmarks.google_message3.Message8184 field8256 = 2;
+ optional .benchmarks.google_message3.Message7966 field8257 = 3;
+ optional string field8258 = 4;
+ optional string field8259 = 5;
+ optional bool field8260 = 6;
+ optional int64 field8261 = 7;
+ optional string field8262 = 8;
+ optional int64 field8263 = 9;
+ optional double field8264 = 10;
+ optional int64 field8265 = 11;
+ repeated string field8266 = 12;
+ optional int64 field8267 = 13;
+ optional int32 field8268 = 14;
+ optional int32 field8269 = 15;
+ optional int64 field8270 = 16;
+ optional double field8271 = 17;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8272 = 18;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8273 = 19;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field8274 = 20;
+ optional bool field8275 = 21;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8276 = 22;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8277 = 23;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field8278 = 24;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8279 = 25;
+ optional bool field8280 = 26;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field8281 = 27;
+}
+
+message Message8392 {
+ optional string field8395 = 1;
+ optional string field8396 = 2;
+ optional .benchmarks.google_message3.Message7966 field8397 = 3;
+ optional string field8398 = 4;
+ optional string field8399 = 5;
+ optional string field8400 = 6;
+ optional string field8401 = 7;
+ optional string field8402 = 8;
+ optional string field8403 = 9;
+}
+
+message Message8130 {
+ optional string field8156 = 1;
+ optional string field8157 = 2;
+ optional string field8158 = 4;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8159 = 6;
+ repeated string field8160 = 7;
+ optional int64 field8161 = 8;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8162 = 9;
+ optional string field8163 = 10;
+ optional string field8164 = 11;
+ optional string field8165 = 12;
+ optional string field8166 = 13;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8167 = 14;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8168 = 15;
+ optional string field8169 = 16;
+ optional .benchmarks.google_message3.UnusedEnum field8170 = 17;
+ optional .benchmarks.google_message3.UnusedEnum field8171 = 18;
+ optional bool field8172 = 19;
+ optional bool field8173 = 20;
+ optional double field8174 = 21;
+ optional int32 field8175 = 22;
+ optional int32 field8176 = 23;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8177 = 24;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field8178 = 25;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field8179 = 26;
+}
+
+message Message8478 {
+ optional string field8489 = 7;
+ optional .benchmarks.google_message3.Message7966 field8490 = 1;
+ optional .benchmarks.google_message3.Message8476 field8491 = 2;
+ optional int64 field8492 = 3;
+ optional .benchmarks.google_message3.Message8476 field8493 = 4;
+ repeated .benchmarks.google_message3.Message8477 field8494 = 5;
+ optional .benchmarks.google_message3.Message8454 field8495 = 6;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8496 = 8;
+}
+
+message Message8479 {
+ optional .benchmarks.google_message3.Message8475 field8497 = 1;
+ optional .benchmarks.google_message3.Message7966 field8498 = 2;
+ optional .benchmarks.google_message3.Message8476 field8499 = 3;
+ optional .benchmarks.google_message3.Message8476 field8500 = 4;
+ optional string field8501 = 6;
+ optional string field8502 = 7;
+ optional .benchmarks.google_message3.Message7966 field8503 = 8;
+ optional .benchmarks.google_message3.Message8455 field8504 = 5;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8505 = 9;
+}
+
+message Message10319 {
+ optional .benchmarks.google_message3.Enum10325 field10340 = 1;
+ optional int32 field10341 = 4;
+ optional int32 field10342 = 5;
+ optional bytes field10343 = 3;
+ optional string field10344 = 2;
+ optional string field10345 = 6;
+ optional string field10346 = 7;
+}
+
+message Message4016 {
+ required int32 field4017 = 1;
+ required int32 field4018 = 2;
+ required int32 field4019 = 3;
+ required int32 field4020 = 4;
+}
+
+message Message12669 {
+ optional .benchmarks.google_message3.Message12559 field12681 = 1;
+ optional float field12682 = 2;
+ optional bool field12683 = 3;
+ optional .benchmarks.google_message3.Enum12670 field12684 = 4;
+}
+
+message Message12819 {
+ optional double field12834 = 1;
+ optional double field12835 = 2;
+ optional double field12836 = 3;
+ optional double field12837 = 4;
+ optional double field12838 = 5;
+ optional double field12839 = 6;
+}
+
+message Message12820 {
+ optional int32 field12840 = 1;
+ optional int32 field12841 = 2;
+ optional int32 field12842 = 3;
+ optional int32 field12843 = 8;
+ optional int32 field12844 = 4;
+ optional int32 field12845 = 5;
+ optional int32 field12846 = 6;
+ optional int32 field12847 = 7;
+}
+
+message Message12821 {
+ optional int32 field12848 = 1;
+ optional int32 field12849 = 2;
+ optional int32 field12850 = 3;
+ optional int32 field12851 = 4;
+ optional int32 field12852 = 5;
+}
+
+message Message12818 {
+ optional uint64 field12829 = 1;
+ optional int32 field12830 = 2;
+ optional int32 field12831 = 3;
+ optional int32 field12832 = 5;
+ repeated .benchmarks.google_message3.Message12817 field12833 = 4;
+}
+
+message Message16479 {
+ optional .benchmarks.google_message3.Message16480 field16484 = 1;
+ optional int32 field16485 = 5;
+ optional float field16486 = 2;
+ optional uint32 field16487 = 4;
+ optional bool field16488 = 3;
+ optional uint32 field16489 = 6;
+}
+
+message Message16722 {
+ optional string field16752 = 1;
+ optional string field16753 = 2;
+ optional string field16754 = 3;
+ optional int32 field16755 = 5;
+ optional string field16756 = 4;
+}
+
+message Message16724 {
+ optional int64 field16761 = 1;
+ optional float field16762 = 2;
+ optional int64 field16763 = 3;
+ optional int64 field16764 = 4;
+ optional bool field16765 = 5;
+ repeated string field16766 = 6;
+ repeated string field16767 = 7;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field16768 = 8;
+ optional bool field16769 = 9;
+ optional uint32 field16770 = 10;
+ optional .benchmarks.google_message3.Enum16728 field16771 = 11;
+ repeated int32 field16772 = 12;
+ optional bool field16773 = 13;
+}
+
+message Message17728 {
+}
+
+message Message24356 {
+ optional string field24559 = 1;
+ optional string field24560 = 2;
+ optional int32 field24561 = 14;
+ optional string field24562 = 3;
+ optional string field24563 = 4;
+ optional string field24564 = 5;
+ optional .benchmarks.google_message3.UnusedEnum field24565 = 13;
+ optional string field24566 = 6;
+ optional .benchmarks.google_message3.Enum24361 field24567 = 12;
+ optional string field24568 = 7;
+ optional string field24569 = 8;
+ optional string field24570 = 9;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field24571 = 10;
+ repeated string field24572 = 11;
+ repeated string field24573 = 15;
+}
+
+message Message24376 {
+ optional string field24589 = 1;
+ optional string field24590 = 2;
+ optional string field24591 = 3;
+ required .benchmarks.google_message3.Message24377 field24592 = 4;
+ optional .benchmarks.google_message3.Message24317 field24593 = 5;
+ optional string field24594 = 6;
+ optional .benchmarks.google_message3.Message24378 field24595 = 7;
+ repeated string field24596 = 8;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field24597 = 14;
+ repeated string field24598 = 9;
+ repeated string field24599 = 10;
+ repeated string field24600 = 11;
+ optional string field24601 = 12;
+ repeated string field24602 = 13;
+}
+
+message Message24366 {
+ optional string field24574 = 1;
+ optional string field24575 = 2;
+ optional string field24576 = 3;
+ optional int32 field24577 = 10;
+ optional string field24578 = 13;
+ optional string field24579 = 4;
+ optional string field24580 = 5;
+ optional .benchmarks.google_message3.UnusedEnum field24581 = 9;
+ optional string field24582 = 14;
+ optional .benchmarks.google_message3.UnusedEnum field24583 = 15;
+ optional string field24584 = 6;
+ optional string field24585 = 12;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field24586 = 7;
+ repeated string field24587 = 8;
+ repeated string field24588 = 11;
+}
+
diff --git a/benchmarks/datasets/google_message3/benchmark_message3_4.proto b/benchmarks/datasets/google_message3/benchmark_message3_4.proto
new file mode 100644
index 00000000..34ee06db
--- /dev/null
+++ b/benchmarks/datasets/google_message3/benchmark_message3_4.proto
@@ -0,0 +1,490 @@
+syntax = "proto2";
+
+import "datasets/google_message3/benchmark_message3_5.proto";
+import "datasets/google_message3/benchmark_message3_6.proto";
+import "datasets/google_message3/benchmark_message3_7.proto";
+import "datasets/google_message3/benchmark_message3_8.proto";
+package benchmarks.google_message3;
+
+option cc_enable_arenas = true;
+
+message Message24346 {
+}
+
+message Message24401 {
+ optional .benchmarks.google_message3.Message24400 field24679 = 1;
+}
+
+message Message24402 {
+ optional .benchmarks.google_message3.Message24400 field24680 = 1;
+}
+
+message Message24379 {
+ optional string field24603 = 1;
+ optional string field24604 = 2;
+ optional string field24605 = 3;
+ required .benchmarks.google_message3.Message24380 field24606 = 4;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24607 = 5;
+ optional string field24608 = 6;
+ optional .benchmarks.google_message3.Message24381 field24609 = 7;
+ repeated string field24610 = 8;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field24611 = 17;
+ repeated string field24612 = 9;
+ repeated string field24613 = 10;
+ repeated string field24614 = 11;
+ optional string field24615 = 14;
+ optional string field24616 = 12;
+ optional string field24617 = 16;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field24618 = 13;
+ repeated string field24619 = 15;
+ repeated string field24620 = 18;
+}
+
+message Message27358 {
+ optional int32 field27415 = 1;
+ optional int32 field27416 = 2;
+}
+
+message Message34381 {
+ optional string field34398 = 1;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field34399 = 2;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field34400 = 3;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field34401 = 4;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field34402 = 5;
+ optional bool field34403 = 6;
+ optional bool field34404 = 7;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field34405 = 8;
+ optional bool field34406 = 9;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field34407 = 10;
+}
+
+message Message34619 {
+ optional double field34641 = 1;
+ optional double field34642 = 2;
+ optional double field34643 = 3;
+ optional double field34644 = 4;
+ optional double field34645 = 11;
+ optional double field34646 = 5;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field34647 = 100;
+}
+
+message Message730 {
+ optional string field897 = 19;
+ repeated string field898 = 27;
+ repeated string field899 = 28;
+ repeated string field900 = 21;
+ optional string field901 = 30;
+ repeated uint32 field902 = 20;
+ repeated uint32 field903 = 32;
+ repeated string field904 = 16;
+ repeated .benchmarks.google_message3.Message697 field905 = 6;
+ repeated .benchmarks.google_message3.Message704 field906 = 7;
+ repeated string field907 = 18;
+ repeated .benchmarks.google_message3.Message703 field908 = 8;
+ repeated string field909 = 9;
+ optional .benchmarks.google_message3.Message716 field910 = 10;
+ optional .benchmarks.google_message3.Message718 field911 = 11;
+ optional bool field912 = 14;
+ repeated .benchmarks.google_message3.Message715 field913 = 4;
+ repeated string field914 = 17;
+ repeated string field915 = 23;
+ repeated .benchmarks.google_message3.Message719 field916 = 24;
+ repeated .benchmarks.google_message3.Message728 field917 = 26;
+ repeated .benchmarks.google_message3.Message702 field918 = 35;
+ optional string field919 = 36;
+ repeated string field920 = 37;
+ optional int64 field921 = 38;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field922 = 39;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field923 = 1;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field924 = 2;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field925 = 3;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field926 = 5;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field927 = 13;
+ repeated string field928 = 22;
+ optional bytes field929 = 31;
+ extensions 25 to 25;
+ extensions 29 to 29;
+ extensions 34 to 34;
+ extensions 15 to 15;
+}
+
+message Message33958 {
+ optional string field33977 = 1;
+ optional string field33978 = 9;
+ repeated group Message33959 = 2 {
+ required string field33982 = 3;
+ optional string field33983 = 4;
+ optional string field33984 = 5;
+ optional fixed64 field33985 = 8;
+ optional bool field33986 = 10;
+ optional .benchmarks.google_message3.Message0 field33987 = 6;
+ }
+ optional .benchmarks.google_message3.Enum33960 field33980 = 7;
+ extend .benchmarks.google_message3.Message0 {
+ optional .benchmarks.google_message3.Message33958 field33981 = 10747482;
+ }
+}
+
+message Message6637 {
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6670 = 2;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field6671 = 1;
+ optional int32 field6672 = 3;
+ repeated string field6673 = 4;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6674 = 5;
+}
+
+message Message6643 {
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6683 = 3;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6684 = 4;
+ optional double field6685 = 5;
+ optional double field6686 = 6;
+ optional int32 field6687 = 1;
+ optional int32 field6688 = 2;
+ optional double field6689 = 9;
+ optional bytes field6690 = 10;
+ optional int32 field6691 = 11;
+ optional bool field6692 = 12;
+ optional bool field6693 = 13;
+ optional .benchmarks.google_message3.Message6578 field6694 = 15;
+ optional .benchmarks.google_message3.UnusedEnum field6695 = 16;
+ optional int64 field6696 = 17;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field6697 = 22;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6698 = 19;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6699 = 20;
+ optional int32 field6700 = 21;
+}
+
+message Message6126 {
+ required string field6152 = 1;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field6153 = 9;
+ optional int32 field6154 = 14;
+ optional bytes field6155 = 10;
+ optional .benchmarks.google_message3.Message6024 field6156 = 12;
+ optional int32 field6157 = 4;
+ optional string field6158 = 5;
+ optional int32 field6159 = 6;
+ repeated int32 field6160 = 2;
+ repeated int32 field6161 = 3;
+ repeated .benchmarks.google_message3.Message6052 field6162 = 7;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field6163 = 11;
+ optional .benchmarks.google_message3.Enum6065 field6164 = 15;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field6165 = 8;
+ optional bool field6166 = 13;
+ optional bool field6167 = 16;
+ optional bool field6168 = 18;
+ repeated .benchmarks.google_message3.Message6054 field6169 = 17;
+ optional int32 field6170 = 19;
+}
+
+message Message13083 {
+ optional float field13096 = 1;
+ repeated group Message13084 = 2 {
+ required float field13107 = 3;
+ required int32 field13108 = 4;
+ optional float field13109 = 5;
+ repeated .benchmarks.google_message3.Enum13092 field13110 = 6;
+ }
+ optional float field13098 = 44;
+ optional float field13099 = 45;
+ optional uint64 field13100 = 46;
+ optional float field13101 = 47;
+ optional group Message13085 = 16 {
+ }
+ repeated group Message13086 = 23 {
+ }
+ repeated group Message13087 = 29 {
+ }
+ optional .benchmarks.google_message3.UnusedEmptyMessage field13105 = 43;
+}
+
+message Message13088 {
+ repeated group Message13089 = 1 {
+ required string field13139 = 2;
+ optional float field13140 = 3;
+ }
+ optional int64 field13136 = 4;
+ optional bool field13137 = 5;
+}
+
+message Message10391 {
+ optional .benchmarks.google_message3.Enum10392 field10411 = 1;
+ optional .benchmarks.google_message3.UnusedEnum field10412 = 2;
+ optional int64 field10413 = 3;
+ optional string field10414 = 4;
+ optional string field10415 = 5;
+ optional bytes field10416 = 6;
+ optional bool field10417 = 8;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field10418 = 9;
+ optional bool field10419 = 10;
+}
+
+message Message11873 {
+ optional string field11876 = 1;
+ optional string field11877 = 4;
+ optional .benchmarks.google_message3.Message10573 field11878 = 5;
+ optional .benchmarks.google_message3.Message10582 field11879 = 6;
+ optional .benchmarks.google_message3.Message10824 field11880 = 7;
+ optional .benchmarks.google_message3.Message10773 field11881 = 12;
+ optional .benchmarks.google_message3.Message11866 field11882 = 8;
+ optional .benchmarks.google_message3.Message10818 field11883 = 13;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field11884 = 16;
+ optional .benchmarks.google_message3.Message10155 field11885 = 11;
+ optional .benchmarks.google_message3.Message10469 field11886 = 14;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field11887 = 15;
+ extensions 9 to 9;
+ extensions 10 to 10;
+}
+
+message Message35506 {
+ optional int32 field35524 = 1;
+ optional string field35525 = 2;
+ optional .benchmarks.google_message3.Enum35507 field35526 = 3;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field35527 = 4;
+}
+
+message Message13151 {
+ repeated .benchmarks.google_message3.Message13145 field13158 = 1;
+}
+
+message Message18253 {
+ repeated group Message18254 = 1 {
+ required fixed64 field18362 = 2;
+ required double field18363 = 3;
+ }
+}
+
+message Message16685 {
+ repeated .benchmarks.google_message3.Message16686 field16694 = 2;
+}
+
+message Message16816 {
+ optional float field16826 = 1;
+ optional .benchmarks.google_message3.Enum16819 field16827 = 2;
+ optional float field16828 = 3;
+ repeated group Message16817 = 4 {
+ }
+ optional bool field16830 = 7;
+ optional bool field16831 = 8;
+ repeated group Message16818 = 12 {
+ }
+ optional string field16833 = 10;
+ optional bool field16834 = 13;
+ optional bool field16835 = 14;
+}
+
+message Message13168 {
+ required int32 field13212 = 1;
+ optional fixed64 field13213 = 7;
+ optional bool field13214 = 8;
+ optional fixed64 field13215 = 10;
+ optional bool field13216 = 11;
+ optional .benchmarks.google_message3.Message12796 field13217 = 9;
+ required double field13218 = 2;
+ required bool field13219 = 3;
+ optional int32 field13220 = 4;
+ required bool field13221 = 5;
+ optional int32 field13222 = 6;
+}
+
+message Message13167 {
+ required int32 field13199 = 1;
+ optional int32 field13200 = 2;
+ optional int32 field13201 = 3;
+ optional bool field13202 = 8;
+ optional fixed64 field13203 = 12;
+ optional bool field13204 = 13;
+ optional .benchmarks.google_message3.Message12796 field13205 = 11;
+ optional fixed64 field13206 = 9;
+ optional bool field13207 = 10;
+ repeated int32 field13208 = 4;
+ optional int32 field13209 = 5;
+ optional int32 field13210 = 6;
+ optional int32 field13211 = 7;
+}
+
+message Message1374 {
+ required string field1375 = 1;
+ optional string field1376 = 2;
+}
+
+message Message18943 {
+}
+
+message Message18944 {
+}
+
+message Message18856 {
+ optional string field18857 = 1;
+ optional string field18858 = 2;
+ optional bool field18859 = 31;
+ optional string field18860 = 26;
+ optional string field18861 = 3;
+ optional string field18862 = 4;
+ optional string field18863 = 5;
+ optional string field18864 = 17;
+ optional string field18865 = 6;
+ optional string field18866 = 7;
+ optional string field18867 = 8;
+ optional string field18868 = 9;
+ optional string field18869 = 10;
+ optional string field18870 = 11;
+ optional string field18871 = 21;
+ optional string field18872 = 18;
+ optional string field18873 = 19;
+ optional string field18874 = 20;
+ optional string field18875 = 22;
+ optional string field18876 = 23;
+ optional string field18877 = 24;
+ optional string field18878 = 25;
+ optional string field18879 = 12;
+ optional string field18880 = 13;
+ optional string field18881 = 29;
+ optional string field18882 = 30;
+ optional string field18883 = 15;
+ optional string field18884 = 16;
+ repeated string field18885 = 14;
+ optional string field18886 = 27;
+ optional string field18887 = 28;
+}
+
+message Message3850 {
+ optional .benchmarks.google_message3.Enum3851 field3924 = 2;
+ optional bool field3925 = 12;
+ optional int32 field3926 = 4;
+ optional bool field3927 = 10;
+ optional bool field3928 = 13;
+ optional bool field3929 = 14;
+}
+
+message Message6721 {
+ optional .benchmarks.google_message3.Message6722 field6744 = 1;
+ optional bool field6745 = 2;
+ optional bool field6746 = 3;
+ optional bool field6747 = 4;
+}
+
+message Message6742 {
+ optional bool field6758 = 1;
+}
+
+message Message6726 {
+ optional int64 field6752 = 1;
+ repeated .benchmarks.google_message3.Message6727 field6753 = 2;
+}
+
+message Message6733 {
+ optional int64 field6754 = 1;
+ optional int64 field6755 = 2;
+ optional bool field6756 = 3;
+}
+
+message Message6723 {
+ optional int64 field6748 = 1;
+ repeated .benchmarks.google_message3.Message6724 field6749 = 2;
+}
+
+message Message6725 {
+ optional int32 field6750 = 1;
+ optional int32 field6751 = 2;
+}
+
+message Message6734 {
+ repeated .benchmarks.google_message3.Message6735 field6757 = 1;
+}
+
+message Message8184 {
+ optional .benchmarks.google_message3.Message7966 field8228 = 1;
+ optional bool field8229 = 2;
+ repeated .benchmarks.google_message3.Message8183 field8230 = 3;
+}
+
+message Message8477 {
+ optional .benchmarks.google_message3.Message7966 field8486 = 1;
+ optional int64 field8487 = 2;
+ optional string field8488 = 3;
+}
+
+message Message8454 {
+ optional .benchmarks.google_message3.Message8449 field8465 = 1;
+ optional int64 field8466 = 3;
+ optional int32 field8467 = 4;
+ optional bool field8468 = 5;
+ extend .benchmarks.google_message3.Message8301 {
+ optional .benchmarks.google_message3.Message8454 field8469 = 66;
+ }
+}
+
+message Message8476 {
+ optional string field8483 = 1;
+ optional string field8484 = 2;
+ optional string field8485 = 3;
+}
+
+message Message8455 {
+ optional .benchmarks.google_message3.Message8449 field8470 = 1;
+ repeated .benchmarks.google_message3.Message8456 field8471 = 2;
+ optional .benchmarks.google_message3.Message8457 field8472 = 5;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8473 = 6;
+ extend .benchmarks.google_message3.Message8302 {
+ optional .benchmarks.google_message3.Message8455 field8474 = 66;
+ }
+}
+
+message Message8475 {
+ optional string field8481 = 1;
+ optional int64 field8482 = 2;
+}
+
+message Message12559 {
+}
+
+message Message12817 {
+ optional int32 field12826 = 1;
+ optional int32 field12827 = 2;
+ optional int32 field12828 = 3;
+}
+
+message Message16480 {
+ optional .benchmarks.google_message3.Message13358 field16490 = 1;
+ optional .benchmarks.google_message3.Enum16042 field16491 = 2;
+ optional .benchmarks.google_message3.Message13912 field16492 = 3;
+ optional string field16493 = 4;
+ optional string field16494 = 5;
+ optional string field16495 = 6;
+ optional string field16496 = 7;
+ optional .benchmarks.google_message3.Message13358 field16497 = 8;
+ optional fixed32 field16498 = 9;
+}
+
+message Message24317 {
+ optional string field24446 = 1;
+ optional .benchmarks.google_message3.Message24312 field24447 = 2;
+ repeated .benchmarks.google_message3.Message24315 field24448 = 3;
+ repeated .benchmarks.google_message3.Message24313 field24449 = 4;
+ repeated .benchmarks.google_message3.Message24316 field24450 = 5;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field24451 = 6;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field24452 = 7;
+ repeated string field24453 = 8;
+ repeated string field24454 = 9;
+ repeated string field24455 = 10;
+ repeated string field24456 = 28;
+ optional string field24457 = 11;
+ optional string field24458 = 12;
+ optional string field24459 = 13;
+ optional string field24460 = 14;
+ repeated string field24461 = 15;
+ optional string field24462 = 16;
+ repeated string field24463 = 17;
+ repeated string field24464 = 18;
+ repeated string field24465 = 19;
+ repeated string field24466 = 20;
+ repeated string field24467 = 21;
+ repeated string field24468 = 22;
+ repeated string field24469 = 23;
+ repeated string field24470 = 24;
+ optional string field24471 = 25;
+ optional string field24472 = 26;
+ repeated string field24473 = 27;
+ optional bool field24474 = 40;
+}
+
diff --git a/benchmarks/datasets/google_message3/benchmark_message3_5.proto b/benchmarks/datasets/google_message3/benchmark_message3_5.proto
new file mode 100644
index 00000000..c3f1bf55
--- /dev/null
+++ b/benchmarks/datasets/google_message3/benchmark_message3_5.proto
@@ -0,0 +1,472 @@
+syntax = "proto2";
+
+import "datasets/google_message3/benchmark_message3_6.proto";
+import "datasets/google_message3/benchmark_message3_7.proto";
+import "datasets/google_message3/benchmark_message3_8.proto";
+package benchmarks.google_message3;
+
+option cc_enable_arenas = true;
+
+message Message24377 {
+}
+
+message Message24378 {
+}
+
+message Message24400 {
+ optional int32 field24674 = 1;
+ optional int32 field24675 = 2;
+ optional int32 field24676 = 3;
+ optional int32 field24677 = 4;
+ optional int32 field24678 = 5;
+}
+
+message Message24380 {
+}
+
+message Message24381 {
+}
+
+message Message719 {
+ repeated string field881 = 1;
+ repeated string field882 = 2;
+ repeated string field883 = 3;
+ optional .benchmarks.google_message3.Enum720 field884 = 4;
+}
+
+message Message728 {
+ required string field887 = 1;
+ repeated string field888 = 2;
+ repeated .benchmarks.google_message3.Message703 field889 = 3;
+ repeated .benchmarks.google_message3.Message715 field890 = 4;
+ repeated string field891 = 5;
+ repeated string field892 = 6;
+ optional .benchmarks.google_message3.Message718 field893 = 7;
+ optional .benchmarks.google_message3.Message716 field894 = 8;
+ repeated string field895 = 9;
+ extensions 10 to 10;
+ extensions 11 to 11;
+ extensions 12 to 12;
+}
+
+message Message704 {
+ optional string field800 = 1;
+ optional string field801 = 7;
+ optional string field802 = 2;
+ optional string field803 = 3;
+ optional string field804 = 4;
+ optional string field805 = 5;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field806 = 6;
+}
+
+message Message697 {
+ optional string field743 = 7;
+ repeated string field744 = 1;
+ repeated string field745 = 2;
+ repeated string field746 = 33;
+ repeated string field747 = 29;
+ repeated string field748 = 30;
+ repeated string field749 = 31;
+ repeated string field750 = 32;
+ repeated string field751 = 13;
+ repeated string field752 = 6;
+ repeated string field753 = 3;
+ repeated string field754 = 14;
+ repeated string field755 = 15;
+ repeated string field756 = 16;
+ repeated string field757 = 4;
+ repeated string field758 = 34;
+ repeated string field759 = 35;
+ repeated string field760 = 5;
+ repeated string field761 = 17;
+ repeated string field762 = 18;
+ repeated string field763 = 19;
+ optional bool field764 = 36;
+ repeated string field765 = 8;
+ repeated string field766 = 9;
+ optional string field767 = 27;
+ optional bool field768 = 25;
+ optional .benchmarks.google_message3.Message700 field769 = 10;
+ optional bool field770 = 11;
+ optional bool field771 = 24;
+ repeated string field772 = 12;
+ repeated string field773 = 20;
+ repeated string field774 = 21;
+ repeated string field775 = 22;
+ repeated .benchmarks.google_message3.Message699 field776 = 23;
+ repeated .benchmarks.google_message3.Message698 field777 = 37;
+ optional int64 field778 = 38;
+ extensions 28 to 28;
+ extensions 26 to 26;
+}
+
+message Message0 {
+ option message_set_wire_format = true;
+ extensions 4 to 2147483646;
+}
+
+message Message6578 {
+ optional .benchmarks.google_message3.Enum6579 field6632 = 1;
+ optional .benchmarks.google_message3.Enum6588 field6633 = 2;
+}
+
+message Message6024 {
+ optional .benchmarks.google_message3.Enum6025 field6048 = 1;
+ optional string field6049 = 2;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field6050 = 3;
+}
+
+message Message6052 {
+ required string field6084 = 1;
+ required bytes field6085 = 2;
+}
+
+message Message6054 {
+ required string field6089 = 1;
+ optional string field6090 = 2;
+}
+
+message Message10573 {
+ repeated .benchmarks.google_message3.Message10576 field10580 = 1;
+ optional string field10581 = 2;
+ extensions 10000 to 536870911;
+}
+
+message Message10824 {
+ required string field10825 = 1;
+ optional int32 field10826 = 2;
+}
+
+message Message10582 {
+ required bool field10583 = 1;
+ required double field10584 = 2;
+ optional bool field10585 = 3;
+ optional double field10586 = 4;
+ optional double field10587 = 5;
+ optional bool field10588 = 6;
+}
+
+message Message10155 {
+ required int32 field10195 = 1;
+ required int32 field10196 = 2;
+ optional .benchmarks.google_message3.Enum10157 field10197 = 59;
+ optional int32 field10198 = 18;
+ optional int32 field10199 = 19;
+ optional int32 field10200 = 21;
+ repeated group Message10156 = 50 {
+ optional .benchmarks.google_message3.Enum8862 field10266 = 51;
+ optional int32 field10267 = 52;
+ optional int32 field10268 = 53;
+ optional int32 field10269 = 54;
+ }
+ optional int32 field10202 = 3;
+ optional int32 field10203 = 4;
+ optional int32 field10204 = 5;
+ optional bool field10205 = 84;
+ optional bool field10206 = 33;
+ optional int32 field10207 = 75;
+ optional float field10208 = 26;
+ optional int32 field10209 = 27;
+ optional int32 field10210 = 49;
+ optional int32 field10211 = 10;
+ optional float field10212 = 78;
+ optional .benchmarks.google_message3.Message9151 field10213 = 91;
+ optional int32 field10214 = 11;
+ optional int32 field10215 = 12;
+ optional float field10216 = 41;
+ optional .benchmarks.google_message3.Message10154 field10217 = 61;
+ optional int32 field10218 = 23;
+ optional bytes field10219 = 24;
+ optional int32 field10220 = 65;
+ repeated bytes field10221 = 66;
+ optional int32 field10222 = 70;
+ optional bytes field10223 = 71;
+ repeated fixed64 field10224 = 73;
+ optional float field10225 = 29;
+ optional int32 field10226 = 30;
+ optional float field10227 = 31;
+ optional int32 field10228 = 32;
+ optional float field10229 = 34;
+ optional int32 field10230 = 35;
+ optional string field10231 = 22;
+ optional fixed64 field10232 = 13;
+ optional fixed64 field10233 = 20;
+ optional bool field10234 = 79;
+ repeated .benchmarks.google_message3.Enum10167 field10235 = 80 [packed = true];
+ optional int32 field10236 = 14;
+ optional int32 field10237 = 15;
+ optional int32 field10238 = 28;
+ repeated string field10239 = 16;
+ optional .benchmarks.google_message3.Message9182 field10240 = 17;
+ optional int32 field10241 = 63;
+ optional float field10242 = 64;
+ optional float field10243 = 37;
+ repeated float field10244 = 43;
+ optional int32 field10245 = 44;
+ optional .benchmarks.google_message3.Message9242 field10246 = 45;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field10247 = 46;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field10248 = 62;
+ optional .benchmarks.google_message3.Message8944 field10249 = 48;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field10250 = 87;
+ optional int32 field10251 = 58;
+ optional int32 field10252 = 92;
+ optional .benchmarks.google_message3.Message9123 field10253 = 93;
+ optional .benchmarks.google_message3.Message9160 field10254 = 60;
+ optional .benchmarks.google_message3.Message8890 field10255 = 67;
+ optional string field10256 = 69;
+ optional int64 field10257 = 74;
+ optional float field10258 = 82;
+ optional float field10259 = 85;
+ optional float field10260 = 86;
+ optional int64 field10261 = 83;
+ optional string field10262 = 77;
+ optional bool field10263 = 88;
+ repeated .benchmarks.google_message3.Message9628 field10264 = 94;
+ extensions 57 to 57;
+ extensions 1000 to 536870911;
+}
+
+message Message11866 {
+ required .benchmarks.google_message3.Message11014 field11868 = 1;
+ optional bool field11869 = 2;
+ optional double field11870 = 3;
+ optional double field11871 = 4;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field11872 = 5;
+}
+
+message Message10469 {
+ optional string field10473 = 1;
+ optional float field10474 = 2;
+ optional int32 field10475 = 3;
+ optional int32 field10476 = 4;
+ optional int32 field10477 = 5;
+ optional bool field10478 = 6;
+ optional bool field10479 = 7;
+ optional int32 field10480 = 8;
+ optional float field10481 = 9;
+}
+
+message Message10818 {
+ optional .benchmarks.google_message3.Message10800 field10819 = 1;
+ optional .benchmarks.google_message3.Message10801 field10820 = 2;
+}
+
+message Message10773 {
+ optional bool field10774 = 9;
+ optional bool field10775 = 1;
+ optional bool field10776 = 23;
+ optional bool field10777 = 2;
+ optional bool field10778 = 3;
+ optional int32 field10779 = 4;
+ optional int32 field10780 = 5;
+ optional int32 field10781 = 6;
+ optional int32 field10782 = 7;
+ optional int32 field10783 = 8;
+ optional int32 field10784 = 10;
+ optional .benchmarks.google_message3.Message10749 field10785 = 11;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field10786 = 12;
+ optional bool field10787 = 13;
+ optional bool field10788 = 15;
+ optional bool field10789 = 16;
+ optional int32 field10790 = 17;
+ optional int32 field10791 = 18;
+ optional bool field10792 = 19;
+ optional bool field10793 = 20;
+ optional bool field10794 = 21;
+ optional .benchmarks.google_message3.UnusedEnum field10795 = 14;
+ optional .benchmarks.google_message3.UnusedEnum field10796 = 22;
+}
+
+message Message13145 {
+ required .benchmarks.google_message3.Enum13146 field13155 = 1;
+ optional float field13156 = 2;
+ optional float field13157 = 3;
+ extensions 1000 to 536870911;
+}
+
+message Message16686 {
+}
+
+message Message12796 {
+ repeated fixed64 field12800 = 1;
+ optional uint64 field12801 = 2;
+}
+
+message Message6722 {
+}
+
+message Message6727 {
+}
+
+message Message6724 {
+}
+
+message Message6735 {
+}
+
+message Message8183 {
+ optional string field8226 = 1;
+ optional string field8227 = 2;
+}
+
+message Message8301 {
+ optional string field8328 = 1;
+ optional .benchmarks.google_message3.Message7966 field8329 = 2;
+ optional string field8330 = 3;
+ optional string field8331 = 4;
+ repeated .benchmarks.google_message3.Message8290 field8332 = 5;
+ optional .benchmarks.google_message3.Message7966 field8333 = 6;
+ repeated .benchmarks.google_message3.Message8298 field8334 = 7;
+ optional .benchmarks.google_message3.Message8300 field8335 = 8;
+ optional int64 field8336 = 9;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8337 = 10;
+ optional .benchmarks.google_message3.Message7965 field8338 = 11;
+ extensions 64 to 536870911;
+}
+
+message Message8456 {
+}
+
+message Message8302 {
+ optional string field8339 = 1;
+ optional .benchmarks.google_message3.Message7966 field8340 = 2;
+ optional string field8341 = 3;
+ optional string field8342 = 4;
+ optional string field8343 = 5;
+ optional string field8344 = 6;
+ optional string field8345 = 7;
+ optional int64 field8346 = 8;
+ optional int64 field8347 = 9;
+ repeated .benchmarks.google_message3.Message8290 field8348 = 10;
+ optional string field8349 = 11;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8350 = 12;
+ optional .benchmarks.google_message3.Message8291 field8351 = 13;
+ optional int64 field8352 = 14;
+ optional .benchmarks.google_message3.Message8296 field8353 = 15;
+ optional string field8354 = 16;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field8355 = 17;
+ repeated int32 field8356 = 18;
+ repeated int32 field8357 = 19;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field8358 = 20;
+ optional .benchmarks.google_message3.Message7965 field8359 = 21;
+ extensions 64 to 536870911;
+}
+
+message Message8457 {
+}
+
+message Message8449 {
+ optional string field8458 = 1;
+ optional bool field8459 = 2;
+ optional .benchmarks.google_message3.Enum8450 field8460 = 3;
+ repeated string field8461 = 4;
+ optional string field8462 = 5;
+ optional string field8463 = 6;
+ optional .benchmarks.google_message3.Message7966 field8464 = 7;
+}
+
+message Message13358 {
+ required fixed64 field13359 = 1;
+ required fixed64 field13360 = 2;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field13361 = 3;
+}
+
+message Message13912 {
+ required fixed32 field13913 = 1;
+ required fixed32 field13914 = 2;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field13915 = 500;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field13916 = 15;
+}
+
+message Message24316 {
+ repeated string field24443 = 1;
+ repeated string field24444 = 2;
+ repeated string field24445 = 3;
+}
+
+message Message24312 {
+ optional string field24421 = 1;
+ optional string field24422 = 2;
+ repeated string field24423 = 3;
+ repeated string field24424 = 4;
+ repeated string field24425 = 5;
+ repeated string field24426 = 6;
+}
+
+message Message24313 {
+ optional string field24427 = 1;
+ optional string field24428 = 2;
+ repeated string field24429 = 3;
+ optional string field24430 = 4;
+ optional string field24431 = 5;
+ optional string field24432 = 6;
+ optional string field24433 = 7;
+ repeated string field24434 = 8;
+ optional string field24435 = 9;
+ repeated string field24436 = 10;
+}
+
+message Message24315 {
+ required string field24440 = 1;
+ repeated string field24441 = 2;
+ repeated string field24442 = 3;
+}
+
+message Message716 {
+ required string field872 = 1;
+ required int32 field873 = 2;
+ optional bool field874 = 3;
+ optional .benchmarks.google_message3.Message717 field875 = 4;
+}
+
+message Message718 {
+ repeated string field878 = 1;
+ repeated string field879 = 2;
+ optional string field880 = 3;
+}
+
+message Message703 {
+ required string field795 = 1;
+ repeated string field796 = 2;
+ repeated string field797 = 3;
+ optional string field798 = 4;
+ repeated string field799 = 5;
+}
+
+message Message715 {
+ required string field859 = 1;
+ optional string field860 = 7;
+ repeated .benchmarks.google_message3.Message707 field861 = 2;
+ repeated .benchmarks.google_message3.Message708 field862 = 3;
+ repeated .benchmarks.google_message3.Message711 field863 = 4;
+ repeated .benchmarks.google_message3.Message712 field864 = 5;
+ repeated .benchmarks.google_message3.Message713 field865 = 6;
+ repeated .benchmarks.google_message3.Message714 field866 = 8;
+ repeated .benchmarks.google_message3.Message710 field867 = 9;
+ repeated .benchmarks.google_message3.Message709 field868 = 10;
+ repeated .benchmarks.google_message3.Message705 field869 = 11;
+ repeated .benchmarks.google_message3.Message702 field870 = 12;
+ repeated .benchmarks.google_message3.Message706 field871 = 13;
+}
+
+message Message700 {
+ repeated string field789 = 1;
+ repeated string field790 = 2;
+}
+
+message Message699 {
+ required string field787 = 1;
+ repeated string field788 = 2;
+}
+
+message Message698 {
+ optional string field779 = 1;
+ optional string field780 = 2;
+ optional string field781 = 3;
+ optional string field782 = 4;
+ optional uint64 field783 = 5;
+ optional uint32 field784 = 6;
+ optional int64 field785 = 7;
+ repeated string field786 = 8;
+}
+
diff --git a/benchmarks/datasets/google_message3/benchmark_message3_6.proto b/benchmarks/datasets/google_message3/benchmark_message3_6.proto
new file mode 100644
index 00000000..5d896585
--- /dev/null
+++ b/benchmarks/datasets/google_message3/benchmark_message3_6.proto
@@ -0,0 +1,453 @@
+syntax = "proto2";
+
+import "datasets/google_message3/benchmark_message3_7.proto";
+import "datasets/google_message3/benchmark_message3_8.proto";
+package benchmarks.google_message3;
+
+option cc_enable_arenas = true;
+
+message Message10576 {
+}
+
+message Message10154 {
+ optional bytes field10192 = 1;
+ optional int32 field10193 = 2;
+}
+
+message Message8944 {
+ optional string field9045 = 2;
+ optional string field9046 = 3;
+ optional string field9047 = 23;
+ optional string field9048 = 52;
+ optional int32 field9049 = 53;
+ optional int32 field9050 = 54;
+ optional float field9051 = 55;
+ optional float field9052 = 56;
+ optional string field9053 = 57;
+ optional int64 field9054 = 1;
+ optional bool field9055 = 4;
+ optional int32 field9056 = 5;
+ optional int32 field9057 = 6;
+ optional int32 field9058 = 7;
+ optional float field9059 = 8;
+ optional float field9060 = 11;
+ optional float field9061 = 9;
+ optional float field9062 = 10;
+ optional float field9063 = 13;
+ optional bool field9064 = 14;
+ optional float field9065 = 70;
+ optional int32 field9066 = 71;
+ optional .benchmarks.google_message3.Enum8945 field9067 = 15;
+ optional int32 field9068 = 16;
+ optional int32 field9069 = 17;
+ optional float field9070 = 18;
+ optional float field9071 = 19;
+ optional int32 field9072 = 28;
+ optional int32 field9073 = 29;
+ optional float field9074 = 60;
+ optional float field9075 = 61;
+ optional int32 field9076 = 72;
+ optional int32 field9077 = 73;
+ optional .benchmarks.google_message3.Enum8951 field9078 = 62;
+ optional string field9079 = 20;
+ optional string field9080 = 21;
+ optional string field9081 = 22;
+ optional double field9082 = 31;
+ optional double field9083 = 32;
+ optional double field9084 = 33;
+ optional double field9085 = 36;
+ optional .benchmarks.google_message3.UnusedEnum field9086 = 37;
+ optional double field9087 = 38;
+ optional double field9088 = 39;
+ optional double field9089 = 63;
+ optional double field9090 = 64;
+ optional double field9091 = 65;
+ optional double field9092 = 34;
+ optional .benchmarks.google_message3.UnusedEnum field9093 = 35;
+ optional .benchmarks.google_message3.UnusedEnum field9094 = 66;
+ optional string field9095 = 40;
+ optional string field9096 = 41;
+ optional string field9097 = 42;
+ optional string field9098 = 43;
+ optional string field9099 = 44;
+ optional string field9100 = 45;
+ optional string field9101 = 46;
+ optional string field9102 = 47;
+ optional string field9103 = 48;
+ optional string field9104 = 49;
+ optional .benchmarks.google_message3.Message8939 field9105 = 100;
+ optional int64 field9106 = 101;
+}
+
+message Message9182 {
+ optional string field9205 = 1;
+ optional string field9206 = 2;
+ optional float field9207 = 16;
+ optional int32 field9208 = 17;
+ optional int32 field9209 = 27;
+ optional int32 field9210 = 7;
+ optional int32 field9211 = 8;
+ optional float field9212 = 26;
+ optional float field9213 = 22;
+ optional bool field9214 = 28;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field9215 = 21;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field9216 = 25;
+ repeated .benchmarks.google_message3.Message9181 field9217 = 29;
+ optional bool field9218 = 18;
+ optional bool field9219 = 19;
+ optional bool field9220 = 20;
+ optional .benchmarks.google_message3.Message9164 field9221 = 30;
+ optional .benchmarks.google_message3.Message9165 field9222 = 31;
+ optional .benchmarks.google_message3.Message9166 field9223 = 32;
+ optional float field9224 = 33;
+ optional .benchmarks.google_message3.Message9151 field9225 = 34;
+ optional float field9226 = 35;
+ optional float field9227 = 36;
+ optional float field9228 = 37;
+ optional float field9229 = 38;
+ optional float field9230 = 39;
+ extensions 3 to 6;
+ extensions 9 to 15;
+ extensions 23 to 23;
+ extensions 24 to 24;
+ extensions 1000 to 536870911;
+}
+
+message Message9160 {
+ optional int32 field9161 = 1;
+ optional bytes field9162 = 2;
+}
+
+message Message9242 {
+ repeated .benchmarks.google_message3.Enum9243 field9327 = 1;
+}
+
+message Message8890 {
+ repeated .benchmarks.google_message3.Message8888 field8916 = 1;
+}
+
+message Message9123 {
+ optional float field9135 = 1;
+}
+
+message Message9628 {
+ optional .benchmarks.google_message3.Message9627 field9673 = 1;
+ optional string field9674 = 2;
+ repeated int32 field9675 = 3;
+ optional int32 field9676 = 4;
+}
+
+message Message11014 {
+ optional int32 field11780 = 40;
+ optional string field11781 = 46;
+ optional bool field11782 = 47;
+ optional .benchmarks.google_message3.Enum11107 field11783 = 1;
+ optional int32 field11784 = 2;
+ optional double field11785 = 4;
+ optional int32 field11786 = 5;
+ optional int32 field11787 = 6;
+ optional double field11788 = 7;
+ optional double field11789 = 8;
+ optional int64 field11790 = 9;
+ optional bool field11791 = 10;
+ optional int64 field11792 = 28;
+ optional bool field11793 = 37;
+ optional .benchmarks.google_message3.Enum11541 field11794 = 44;
+ optional double field11795 = 49;
+ optional double field11796 = 51;
+ optional int64 field11797 = 54;
+ optional int64 field11798 = 55;
+ optional .benchmarks.google_message3.UnusedEnum field11799 = 57;
+ optional .benchmarks.google_message3.Enum11468 field11800 = 58;
+ optional int32 field11801 = 59;
+ optional .benchmarks.google_message3.UnusedEnum field11802 = 60;
+ optional int32 field11803 = 61;
+ optional int32 field11804 = 62;
+ optional int32 field11805 = 69;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field11806 = 68;
+ repeated .benchmarks.google_message3.Message11018 field11807 = 71;
+ optional bool field11808 = 50;
+ optional bool field11809 = 56;
+ optional bool field11810 = 66;
+ optional bool field11811 = 63;
+ optional bool field11812 = 64;
+ optional bool field11813 = 65;
+ optional bool field11814 = 67;
+ optional .benchmarks.google_message3.Enum11107 field11815 = 15;
+ optional int64 field11816 = 16;
+ optional double field11817 = 17;
+ optional int64 field11818 = 18;
+ optional int32 field11819 = 19;
+ optional int64 field11820 = 20;
+ optional int32 field11821 = 42;
+ optional int64 field11822 = 52;
+ optional int64 field11823 = 53;
+ optional int64 field11824 = 41;
+ optional double field11825 = 48;
+ repeated .benchmarks.google_message3.Message11020 field11826 = 70;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field11827 = 72;
+ optional double field11828 = 25;
+ optional string field11829 = 26;
+ optional int64 field11830 = 27;
+ optional int64 field11831 = 32;
+ optional uint64 field11832 = 33;
+ optional bool field11833 = 29;
+ optional bool field11834 = 34;
+ optional string field11835 = 30;
+ optional int32 field11836 = 3;
+ optional int32 field11837 = 31;
+ optional int32 field11838 = 73;
+ optional int32 field11839 = 35;
+ optional .benchmarks.google_message3.Enum11022 field11840 = 36;
+ optional .benchmarks.google_message3.Message11013 field11841 = 38;
+ optional double field11842 = 39;
+ optional int32 field11843 = 45;
+ optional bool field11844 = 74;
+}
+
+message Message10801 {
+ optional .benchmarks.google_message3.Message10800 field10812 = 1;
+ repeated .benchmarks.google_message3.Message10802 field10813 = 2;
+ optional int32 field10814 = 3;
+}
+
+message Message10749 {
+ repeated .benchmarks.google_message3.Message10748 field10754 = 1;
+}
+
+message Message8298 {
+ optional .benchmarks.google_message3.Message7966 field8321 = 1;
+ optional int64 field8322 = 2;
+ optional string field8323 = 3;
+}
+
+message Message8300 {
+ optional string field8326 = 1;
+ optional .benchmarks.google_message3.Message7966 field8327 = 2;
+}
+
+message Message8291 {
+ optional string field8306 = 1;
+ optional int32 field8307 = 2;
+ optional string field8308 = 3;
+ optional string field8309 = 4;
+ optional .benchmarks.google_message3.Enum8292 field8310 = 5;
+}
+
+message Message8296 {
+ optional .benchmarks.google_message3.Message7966 field8311 = 1;
+ optional string field8312 = 2;
+ optional .benchmarks.google_message3.Message7966 field8313 = 3;
+ optional int32 field8314 = 4;
+ optional int32 field8315 = 5;
+ optional string field8316 = 6;
+}
+
+message Message7965 {
+ optional int32 field7967 = 1;
+ optional int32 field7968 = 2;
+}
+
+message Message8290 {
+ optional string field8304 = 1;
+ optional string field8305 = 2;
+}
+
+message Message717 {
+ repeated string field876 = 1;
+ optional double field877 = 2;
+}
+
+message Message713 {
+ required .benchmarks.google_message3.Message708 field852 = 1;
+ repeated string field853 = 2;
+}
+
+message Message705 {
+ required string field807 = 1;
+ optional string field808 = 2;
+ optional string field809 = 3;
+ optional bool field810 = 4;
+ optional string field811 = 5;
+ optional string field812 = 6;
+ repeated string field813 = 7;
+}
+
+message Message709 {
+ repeated string field829 = 1;
+ repeated string field830 = 2;
+ repeated string field831 = 3;
+ repeated string field832 = 4;
+ repeated string field833 = 5;
+}
+
+message Message702 {
+ optional string field793 = 1;
+ optional string field794 = 2;
+}
+
+message Message714 {
+ optional string field854 = 1;
+ optional string field855 = 2;
+ optional string field856 = 3;
+ optional string field857 = 4;
+ optional uint32 field858 = 5;
+}
+
+message Message710 {
+ repeated string field834 = 1;
+ optional string field835 = 2;
+ optional string field836 = 3;
+ repeated string field837 = 4;
+ repeated string field838 = 5;
+}
+
+message Message706 {
+ repeated string field814 = 1;
+ optional string field815 = 2;
+ repeated string field816 = 3;
+ repeated string field817 = 4;
+}
+
+message Message707 {
+ required string field818 = 1;
+ required string field819 = 2;
+ required string field820 = 3;
+ optional bool field821 = 4;
+ repeated string field822 = 5;
+}
+
+message Message711 {
+ optional .benchmarks.google_message3.UnusedEmptyMessage field839 = 1;
+ repeated string field840 = 4;
+ repeated string field841 = 2;
+ repeated string field842 = 3;
+}
+
+message Message712 {
+ repeated string field843 = 1;
+ required string field844 = 2;
+ optional string field845 = 3;
+ repeated string field846 = 4;
+ repeated string field847 = 5;
+ optional string field848 = 6;
+ repeated string field849 = 7;
+ optional string field850 = 8;
+ optional string field851 = 9;
+}
+
+message Message8939 {
+ optional string field9010 = 1;
+ optional string field9011 = 2;
+ optional string field9012 = 3;
+ repeated string field9013 = 4;
+ optional string field9014 = 5;
+ repeated group Message8940 = 11 {
+ }
+ optional int64 field9016 = 21;
+ optional int64 field9017 = 22;
+ optional int64 field9018 = 23;
+ optional group Message8941 = 31 {
+ optional string field9033 = 32;
+ optional string field9034 = 33;
+ optional string field9035 = 34;
+ optional string field9036 = 35;
+ optional string field9037 = 36;
+ optional string field9038 = 37;
+ }
+ optional .benchmarks.google_message3.Message8942 field9020 = 38;
+ repeated .benchmarks.google_message3.UnusedEmptyMessage field9021 = 39;
+ repeated string field9022 = 41;
+ optional string field9023 = 42;
+ optional string field9024 = 43;
+ optional string field9025 = 44;
+ optional string field9026 = 45;
+ optional string field9027 = 46;
+ optional string field9028 = 47;
+ optional .benchmarks.google_message3.UnusedEnum field9029 = 48;
+ optional .benchmarks.google_message3.UnusedEnum field9030 = 49;
+ optional group Message8943 = 51 {
+ optional string field9039 = 1;
+ optional string field9040 = 2;
+ optional string field9041 = 3;
+ optional string field9042 = 4;
+ optional string field9043 = 5;
+ optional string field9044 = 6;
+ }
+}
+
+message Message9181 {
+ optional string field9204 = 1;
+}
+
+message Message9164 {
+ optional int32 field9168 = 1;
+ optional int32 field9169 = 2;
+ optional int32 field9170 = 3;
+}
+
+message Message9165 {
+ optional float field9171 = 1;
+ optional float field9172 = 2;
+}
+
+message Message9166 {
+ optional float field9173 = 1;
+ optional int32 field9174 = 2;
+}
+
+message Message9151 {
+ optional double field9152 = 1;
+ optional double field9153 = 2;
+ optional float field9154 = 3;
+ optional float field9155 = 4;
+ optional float field9156 = 5;
+ optional float field9157 = 6;
+ optional float field9158 = 7;
+ optional float field9159 = 8;
+}
+
+message Message8888 {
+ optional int32 field8908 = 1;
+ optional .benchmarks.google_message3.Enum8900 field8909 = 4;
+ repeated int32 field8910 = 2 [packed = true];
+ optional bytes field8911 = 3;
+}
+
+message Message9627 {
+ required int32 field9668 = 1;
+ required int32 field9669 = 2;
+ required int32 field9670 = 3;
+ required int32 field9671 = 4;
+ optional float field9672 = 5;
+}
+
+message Message11020 {
+}
+
+message Message11013 {
+ optional bytes field11757 = 19;
+ optional bytes field11758 = 1;
+ optional bytes field11759 = 2;
+ optional bytes field11760 = 3;
+ optional bytes field11761 = 4;
+ optional bytes field11762 = 5;
+ optional bytes field11763 = 6;
+ optional bytes field11764 = 7;
+ optional bytes field11765 = 8;
+ optional bytes field11766 = 9;
+ optional bytes field11767 = 10;
+ optional bytes field11768 = 11;
+ optional bytes field11769 = 12;
+ optional bytes field11770 = 13;
+ optional bytes field11771 = 14;
+ optional bytes field11772 = 15;
+ optional bytes field11773 = 16;
+ optional bytes field11774 = 17;
+ optional bytes field11775 = 18;
+ optional bytes field11776 = 20;
+ optional bytes field11777 = 21;
+ optional .benchmarks.google_message3.UnusedEmptyMessage field11778 = 23;
+ repeated .benchmarks.google_message3.Message11011 field11779 = 22;
+}
+
diff --git a/benchmarks/datasets/google_message3/benchmark_message3_7.proto b/benchmarks/datasets/google_message3/benchmark_message3_7.proto
new file mode 100644
index 00000000..63dd2beb
--- /dev/null
+++ b/benchmarks/datasets/google_message3/benchmark_message3_7.proto
@@ -0,0 +1,55 @@
+syntax = "proto2";
+
+package benchmarks.google_message3;
+
+option cc_enable_arenas = true;
+
+message Message11018 {
+}
+
+message Message10800 {
+ optional string field10808 = 1;
+ optional int64 field10809 = 2;
+ optional bool field10810 = 3;
+ optional float field10811 = 4;
+}
+
+message Message10802 {
+}
+
+message Message10748 {
+ optional string field10750 = 1;
+ optional int32 field10751 = 2;
+ optional int32 field10752 = 3;
+ optional int32 field10753 = 4;
+}
+
+message Message7966 {
+ optional string field7969 = 1;
+ optional bool field7970 = 2;
+}
+
+message Message708 {
+ optional .benchmarks.google_message3.Message741 field823 = 1;
+ repeated string field824 = 6;
+ optional string field825 = 2;
+ optional string field826 = 3;
+ repeated string field827 = 4;
+ repeated string field828 = 5;
+}
+
+message Message8942 {
+}
+
+message Message11011 {
+ required bytes field11752 = 1;
+ required bytes field11753 = 2;
+}
+
+message UnusedEmptyMessage {
+}
+
+message Message741 {
+ repeated string field936 = 1;
+}
+
diff --git a/benchmarks/datasets/google_message3/benchmark_message3_8.proto b/benchmarks/datasets/google_message3/benchmark_message3_8.proto
new file mode 100644
index 00000000..646297ee
--- /dev/null
+++ b/benchmarks/datasets/google_message3/benchmark_message3_8.proto
@@ -0,0 +1,1899 @@
+syntax = "proto2";
+
+package benchmarks.google_message3;
+
+option cc_enable_arenas = true;
+
+enum Enum720 {
+ ENUM_VALUE721 = 1;
+ ENUM_VALUE722 = 2;
+}
+
+enum Enum3476 {
+ ENUM_VALUE3477 = 0;
+ ENUM_VALUE3478 = 1;
+ ENUM_VALUE3479 = 2;
+ ENUM_VALUE3480 = 3;
+ ENUM_VALUE3481 = 4;
+ ENUM_VALUE3482 = 5;
+ ENUM_VALUE3483 = 6;
+ ENUM_VALUE3484 = 7;
+ ENUM_VALUE3485 = 8;
+ ENUM_VALUE3486 = 9;
+ ENUM_VALUE3487 = 10;
+ ENUM_VALUE3488 = 11;
+ ENUM_VALUE3489 = 12;
+ ENUM_VALUE3490 = 13;
+ ENUM_VALUE3491 = 14;
+ ENUM_VALUE3492 = 15;
+ ENUM_VALUE3493 = 16;
+ ENUM_VALUE3494 = 17;
+ ENUM_VALUE3495 = 18;
+ ENUM_VALUE3496 = 19;
+ ENUM_VALUE3497 = 20;
+ ENUM_VALUE3498 = 21;
+ ENUM_VALUE3499 = 22;
+ ENUM_VALUE3500 = 23;
+ ENUM_VALUE3501 = 24;
+ ENUM_VALUE3502 = 25;
+ ENUM_VALUE3503 = 26;
+ ENUM_VALUE3504 = 27;
+ ENUM_VALUE3505 = 28;
+ ENUM_VALUE3506 = 29;
+ ENUM_VALUE3507 = 30;
+ ENUM_VALUE3508 = 31;
+ ENUM_VALUE3509 = 32;
+ ENUM_VALUE3510 = 33;
+ ENUM_VALUE3511 = 34;
+ ENUM_VALUE3512 = 35;
+ ENUM_VALUE3513 = 36;
+ ENUM_VALUE3514 = 37;
+ ENUM_VALUE3515 = 38;
+ ENUM_VALUE3516 = 39;
+ ENUM_VALUE3517 = 40;
+ ENUM_VALUE3518 = 41;
+ ENUM_VALUE3519 = 42;
+ ENUM_VALUE3520 = 43;
+ ENUM_VALUE3521 = 44;
+ ENUM_VALUE3522 = 45;
+ ENUM_VALUE3523 = 46;
+ ENUM_VALUE3524 = 47;
+ ENUM_VALUE3525 = 48;
+ ENUM_VALUE3526 = 49;
+ ENUM_VALUE3527 = 50;
+ ENUM_VALUE3528 = 51;
+ ENUM_VALUE3529 = 52;
+ ENUM_VALUE3530 = 53;
+ ENUM_VALUE3531 = 54;
+ ENUM_VALUE3532 = 55;
+ ENUM_VALUE3533 = 56;
+ ENUM_VALUE3534 = 57;
+ ENUM_VALUE3535 = 58;
+ ENUM_VALUE3536 = 59;
+ ENUM_VALUE3537 = 60;
+ ENUM_VALUE3538 = 61;
+ ENUM_VALUE3539 = 62;
+ ENUM_VALUE3540 = 63;
+ ENUM_VALUE3541 = 64;
+ ENUM_VALUE3542 = 65;
+ ENUM_VALUE3543 = 66;
+ ENUM_VALUE3544 = 67;
+ ENUM_VALUE3545 = 68;
+ ENUM_VALUE3546 = 69;
+ ENUM_VALUE3547 = 70;
+ ENUM_VALUE3548 = 71;
+ ENUM_VALUE3549 = 72;
+ ENUM_VALUE3550 = 73;
+ ENUM_VALUE3551 = 74;
+ ENUM_VALUE3552 = 75;
+ ENUM_VALUE3553 = 76;
+ ENUM_VALUE3554 = 77;
+ ENUM_VALUE3555 = 78;
+ ENUM_VALUE3556 = 79;
+ ENUM_VALUE3557 = 80;
+ ENUM_VALUE3558 = 81;
+ ENUM_VALUE3559 = 82;
+ ENUM_VALUE3560 = 83;
+ ENUM_VALUE3561 = 84;
+ ENUM_VALUE3562 = 85;
+ ENUM_VALUE3563 = 86;
+ ENUM_VALUE3564 = 87;
+ ENUM_VALUE3565 = 88;
+ ENUM_VALUE3566 = 89;
+ ENUM_VALUE3567 = 90;
+ ENUM_VALUE3568 = 91;
+ ENUM_VALUE3569 = 92;
+ ENUM_VALUE3570 = 93;
+ ENUM_VALUE3571 = 94;
+ ENUM_VALUE3572 = 95;
+ ENUM_VALUE3573 = 96;
+ ENUM_VALUE3574 = 97;
+ ENUM_VALUE3575 = 98;
+ ENUM_VALUE3576 = 99;
+ ENUM_VALUE3577 = 100;
+ ENUM_VALUE3578 = 101;
+ ENUM_VALUE3579 = 102;
+ ENUM_VALUE3580 = 103;
+ ENUM_VALUE3581 = 104;
+ ENUM_VALUE3582 = 105;
+ ENUM_VALUE3583 = 106;
+ ENUM_VALUE3584 = 107;
+ ENUM_VALUE3585 = 108;
+ ENUM_VALUE3586 = 109;
+ ENUM_VALUE3587 = 110;
+ ENUM_VALUE3588 = 111;
+ ENUM_VALUE3589 = 112;
+ ENUM_VALUE3590 = 113;
+ ENUM_VALUE3591 = 114;
+ ENUM_VALUE3592 = 115;
+ ENUM_VALUE3593 = 116;
+ ENUM_VALUE3594 = 117;
+ ENUM_VALUE3595 = 118;
+ ENUM_VALUE3596 = 119;
+ ENUM_VALUE3597 = 120;
+ ENUM_VALUE3598 = 121;
+ ENUM_VALUE3599 = 122;
+ ENUM_VALUE3600 = 123;
+ ENUM_VALUE3601 = 124;
+ ENUM_VALUE3602 = 125;
+ ENUM_VALUE3603 = 126;
+ ENUM_VALUE3604 = 127;
+ ENUM_VALUE3605 = 128;
+ ENUM_VALUE3606 = 129;
+ ENUM_VALUE3607 = 130;
+ ENUM_VALUE3608 = 131;
+ ENUM_VALUE3609 = 132;
+ ENUM_VALUE3610 = 133;
+ ENUM_VALUE3611 = 134;
+ ENUM_VALUE3612 = 135;
+ ENUM_VALUE3613 = 136;
+ ENUM_VALUE3614 = 137;
+ ENUM_VALUE3615 = 138;
+ ENUM_VALUE3616 = 139;
+ ENUM_VALUE3617 = 140;
+ ENUM_VALUE3618 = 141;
+ ENUM_VALUE3619 = 142;
+ ENUM_VALUE3620 = 143;
+ ENUM_VALUE3621 = 144;
+ ENUM_VALUE3622 = 145;
+ ENUM_VALUE3623 = 146;
+ ENUM_VALUE3624 = 147;
+ ENUM_VALUE3625 = 148;
+ ENUM_VALUE3626 = 149;
+ ENUM_VALUE3627 = 150;
+ ENUM_VALUE3628 = 151;
+ ENUM_VALUE3629 = 152;
+ ENUM_VALUE3630 = 153;
+ ENUM_VALUE3631 = 154;
+ ENUM_VALUE3632 = 155;
+ ENUM_VALUE3633 = 156;
+ ENUM_VALUE3634 = 157;
+ ENUM_VALUE3635 = 158;
+ ENUM_VALUE3636 = 159;
+ ENUM_VALUE3637 = 160;
+ ENUM_VALUE3638 = 161;
+ ENUM_VALUE3639 = 162;
+ ENUM_VALUE3640 = 163;
+ ENUM_VALUE3641 = 164;
+ ENUM_VALUE3642 = 165;
+ ENUM_VALUE3643 = 166;
+ ENUM_VALUE3644 = 167;
+ ENUM_VALUE3645 = 168;
+ ENUM_VALUE3646 = 169;
+ ENUM_VALUE3647 = 170;
+ ENUM_VALUE3648 = 171;
+ ENUM_VALUE3649 = 172;
+ ENUM_VALUE3650 = 173;
+ ENUM_VALUE3651 = 174;
+ ENUM_VALUE3652 = 175;
+ ENUM_VALUE3653 = 176;
+ ENUM_VALUE3654 = 177;
+ ENUM_VALUE3655 = 178;
+ ENUM_VALUE3656 = 179;
+ ENUM_VALUE3657 = 180;
+ ENUM_VALUE3658 = 181;
+ ENUM_VALUE3659 = 182;
+ ENUM_VALUE3660 = 183;
+}
+
+enum Enum3805 {
+ ENUM_VALUE3806 = 0;
+ ENUM_VALUE3807 = 1;
+ ENUM_VALUE3808 = 2;
+ ENUM_VALUE3809 = 3;
+ ENUM_VALUE3810 = 4;
+ ENUM_VALUE3811 = 5;
+ ENUM_VALUE3812 = 6;
+ ENUM_VALUE3813 = 7;
+ ENUM_VALUE3814 = 8;
+ ENUM_VALUE3815 = 9;
+ ENUM_VALUE3816 = 11;
+ ENUM_VALUE3817 = 10;
+}
+
+enum Enum3783 {
+ ENUM_VALUE3784 = 0;
+ ENUM_VALUE3785 = 1;
+ ENUM_VALUE3786 = 2;
+ ENUM_VALUE3787 = 3;
+ ENUM_VALUE3788 = 4;
+ ENUM_VALUE3789 = 5;
+ ENUM_VALUE3790 = 6;
+ ENUM_VALUE3791 = 7;
+ ENUM_VALUE3792 = 8;
+ ENUM_VALUE3793 = 9;
+ ENUM_VALUE3794 = 10;
+ ENUM_VALUE3795 = 11;
+ ENUM_VALUE3796 = 12;
+ ENUM_VALUE3797 = 13;
+ ENUM_VALUE3798 = 14;
+ ENUM_VALUE3799 = 15;
+ ENUM_VALUE3800 = 16;
+ ENUM_VALUE3801 = 20;
+ ENUM_VALUE3802 = 21;
+ ENUM_VALUE3803 = 50;
+}
+
+enum Enum3851 {
+ ENUM_VALUE3852 = 0;
+ ENUM_VALUE3853 = 1;
+ ENUM_VALUE3854 = 2;
+ ENUM_VALUE3855 = 3;
+ ENUM_VALUE3856 = 4;
+ ENUM_VALUE3857 = 5;
+ ENUM_VALUE3858 = 6;
+ ENUM_VALUE3859 = 7;
+ ENUM_VALUE3860 = 8;
+ ENUM_VALUE3861 = 9;
+ ENUM_VALUE3862 = 10;
+ ENUM_VALUE3863 = 11;
+ ENUM_VALUE3864 = 12;
+ ENUM_VALUE3865 = 13;
+ ENUM_VALUE3866 = 14;
+ ENUM_VALUE3867 = 15;
+ ENUM_VALUE3868 = 16;
+ ENUM_VALUE3869 = 17;
+}
+
+enum UnusedEnum {
+ UNUSED_ENUM_VALUE1 = 0;
+ UNUSED_ENUM_VALUE2 = 1;
+}
+
+enum Enum4146 {
+ ENUM_VALUE4147 = 0;
+ ENUM_VALUE4148 = 1;
+ ENUM_VALUE4149 = 2;
+ ENUM_VALUE4150 = 3;
+ ENUM_VALUE4151 = 4;
+}
+
+enum Enum4160 {
+ ENUM_VALUE4161 = 0;
+ ENUM_VALUE4162 = 1;
+}
+
+enum Enum4152 {
+ ENUM_VALUE4153 = 0;
+ ENUM_VALUE4154 = 1;
+ ENUM_VALUE4155 = 2;
+ ENUM_VALUE4156 = 3;
+ ENUM_VALUE4157 = 4;
+ ENUM_VALUE4158 = 5;
+ ENUM_VALUE4159 = 6;
+}
+
+enum Enum6025 {
+ ENUM_VALUE6026 = 0;
+ ENUM_VALUE6027 = 1;
+ ENUM_VALUE6028 = 2;
+ ENUM_VALUE6029 = 3;
+ ENUM_VALUE6030 = 4;
+ ENUM_VALUE6031 = 5;
+ ENUM_VALUE6032 = 6;
+ ENUM_VALUE6033 = 7;
+ ENUM_VALUE6034 = 8;
+ ENUM_VALUE6035 = 9;
+ ENUM_VALUE6036 = 10;
+ ENUM_VALUE6037 = 11;
+ ENUM_VALUE6038 = 12;
+ ENUM_VALUE6039 = 13;
+ ENUM_VALUE6040 = 14;
+ ENUM_VALUE6041 = 15;
+ ENUM_VALUE6042 = 16;
+ ENUM_VALUE6043 = 17;
+ ENUM_VALUE6044 = 18;
+ ENUM_VALUE6045 = 19;
+ ENUM_VALUE6046 = 20;
+ ENUM_VALUE6047 = 21;
+}
+
+enum Enum6065 {
+ ENUM_VALUE6066 = 0;
+ ENUM_VALUE6067 = 1;
+ ENUM_VALUE6068 = 2;
+ ENUM_VALUE6069 = 3;
+ ENUM_VALUE6070 = 4;
+ ENUM_VALUE6071 = 5;
+ ENUM_VALUE6072 = 6;
+ ENUM_VALUE6073 = 7;
+ ENUM_VALUE6074 = 8;
+ ENUM_VALUE6075 = 9;
+ ENUM_VALUE6076 = 10;
+ ENUM_VALUE6077 = 11;
+ ENUM_VALUE6078 = 12;
+ ENUM_VALUE6079 = 13;
+ ENUM_VALUE6080 = 14;
+}
+
+enum Enum6579 {
+ ENUM_VALUE6580 = 0;
+ ENUM_VALUE6581 = 2;
+ ENUM_VALUE6582 = 3;
+ ENUM_VALUE6583 = 5;
+ ENUM_VALUE6584 = 10;
+ ENUM_VALUE6585 = 15;
+ ENUM_VALUE6586 = 25;
+ ENUM_VALUE6587 = 30;
+}
+
+enum Enum6588 {
+ ENUM_VALUE6589 = 0;
+ ENUM_VALUE6590 = 1;
+ ENUM_VALUE6591 = 2;
+ ENUM_VALUE6592 = 3;
+ ENUM_VALUE6593 = 4;
+ ENUM_VALUE6594 = 5;
+ ENUM_VALUE6595 = 6;
+ ENUM_VALUE6596 = 7;
+ ENUM_VALUE6597 = 8;
+ ENUM_VALUE6598 = 9;
+ ENUM_VALUE6599 = 10;
+ ENUM_VALUE6600 = 11;
+ ENUM_VALUE6601 = 12;
+ ENUM_VALUE6602 = 13;
+ ENUM_VALUE6603 = 14;
+ ENUM_VALUE6604 = 15;
+ ENUM_VALUE6605 = 16;
+ ENUM_VALUE6606 = 17;
+ ENUM_VALUE6607 = 19;
+ ENUM_VALUE6608 = 20;
+ ENUM_VALUE6609 = 21;
+ ENUM_VALUE6610 = 22;
+ ENUM_VALUE6611 = 23;
+ ENUM_VALUE6612 = 24;
+ ENUM_VALUE6613 = 25;
+ ENUM_VALUE6614 = 26;
+ ENUM_VALUE6615 = 27;
+ ENUM_VALUE6616 = 28;
+ ENUM_VALUE6617 = 29;
+ ENUM_VALUE6618 = 30;
+ ENUM_VALUE6619 = 31;
+ ENUM_VALUE6620 = 32;
+ ENUM_VALUE6621 = 33;
+ ENUM_VALUE6622 = 34;
+}
+
+enum Enum6769 {
+ ENUM_VALUE6770 = 0;
+ ENUM_VALUE6771 = 1;
+ ENUM_VALUE6772 = 2;
+}
+
+enum Enum6774 {
+ ENUM_VALUE6775 = 0;
+ ENUM_VALUE6776 = 1;
+ ENUM_VALUE6777 = 2;
+ ENUM_VALUE6778 = 3;
+ ENUM_VALUE6779 = 4;
+ ENUM_VALUE6780 = 5;
+ ENUM_VALUE6781 = 6;
+}
+
+enum Enum6782 {
+ ENUM_VALUE6783 = 0;
+ ENUM_VALUE6784 = 1;
+ ENUM_VALUE6785 = 2;
+ ENUM_VALUE6786 = 3;
+ ENUM_VALUE6787 = 4;
+ ENUM_VALUE6788 = 5;
+}
+
+enum Enum6858 {
+ ENUM_VALUE6859 = 1;
+ ENUM_VALUE6860 = 2;
+ ENUM_VALUE6861 = 3;
+ ENUM_VALUE6862 = 4;
+}
+
+enum Enum6815 {
+ ENUM_VALUE6816 = 0;
+ ENUM_VALUE6817 = 1;
+ ENUM_VALUE6818 = 2;
+ ENUM_VALUE6819 = 3;
+ ENUM_VALUE6820 = 4;
+ ENUM_VALUE6821 = 5;
+}
+
+enum Enum6822 {
+ ENUM_VALUE6823 = 0;
+ ENUM_VALUE6824 = 1;
+ ENUM_VALUE6825 = 2;
+ ENUM_VALUE6826 = 3;
+}
+
+enum Enum7654 {
+ ENUM_VALUE7655 = 1;
+ ENUM_VALUE7656 = 2;
+ ENUM_VALUE7657 = 3;
+}
+
+enum Enum8292 {
+ ENUM_VALUE8293 = 0;
+ ENUM_VALUE8294 = 1;
+ ENUM_VALUE8295 = 2;
+}
+
+enum Enum8450 {
+ ENUM_VALUE8451 = 0;
+ ENUM_VALUE8452 = 1;
+ ENUM_VALUE8453 = 2;
+}
+
+enum Enum8900 {
+ ENUM_VALUE8901 = 0;
+ ENUM_VALUE8902 = 1;
+ ENUM_VALUE8903 = 2;
+ ENUM_VALUE8904 = 3;
+ ENUM_VALUE8905 = 4;
+}
+
+enum Enum8945 {
+ ENUM_VALUE8946 = 0;
+ ENUM_VALUE8947 = 1;
+ ENUM_VALUE8948 = 2;
+ ENUM_VALUE8949 = 3;
+ ENUM_VALUE8950 = 4;
+}
+
+enum Enum8951 {
+ ENUM_VALUE8952 = 1;
+ ENUM_VALUE8953 = 2;
+ ENUM_VALUE8954 = 3;
+ ENUM_VALUE8955 = 4;
+ ENUM_VALUE8956 = 5;
+ ENUM_VALUE8957 = 6;
+ ENUM_VALUE8958 = 7;
+ ENUM_VALUE8959 = 8;
+}
+
+enum Enum9243 {
+ ENUM_VALUE9244 = -1;
+ ENUM_VALUE9245 = 0;
+ ENUM_VALUE9246 = 1;
+ ENUM_VALUE9247 = 2;
+ ENUM_VALUE9248 = 3;
+ ENUM_VALUE9249 = 4;
+ ENUM_VALUE9250 = 5;
+ ENUM_VALUE9251 = 6;
+ ENUM_VALUE9252 = 7;
+ ENUM_VALUE9253 = 8;
+ ENUM_VALUE9254 = 9;
+ ENUM_VALUE9255 = 10;
+ ENUM_VALUE9256 = 11;
+ ENUM_VALUE9257 = 12;
+ ENUM_VALUE9258 = 13;
+ ENUM_VALUE9259 = 14;
+ ENUM_VALUE9260 = 15;
+ ENUM_VALUE9261 = 16;
+ ENUM_VALUE9262 = 17;
+ ENUM_VALUE9263 = 71;
+ ENUM_VALUE9264 = 72;
+ ENUM_VALUE9265 = 73;
+ ENUM_VALUE9266 = 74;
+ ENUM_VALUE9267 = 18;
+ ENUM_VALUE9268 = 20;
+ ENUM_VALUE9269 = 21;
+ ENUM_VALUE9270 = 22;
+ ENUM_VALUE9271 = 23;
+ ENUM_VALUE9272 = 61;
+ ENUM_VALUE9273 = 62;
+ ENUM_VALUE9274 = 63;
+ ENUM_VALUE9275 = 64;
+ ENUM_VALUE9276 = 66;
+ ENUM_VALUE9277 = 67;
+ ENUM_VALUE9278 = 24;
+ ENUM_VALUE9279 = 25;
+ ENUM_VALUE9280 = 26;
+ ENUM_VALUE9281 = 27;
+ ENUM_VALUE9282 = 28;
+ ENUM_VALUE9283 = 29;
+ ENUM_VALUE9284 = 30;
+ ENUM_VALUE9285 = 31;
+ ENUM_VALUE9286 = 32;
+ ENUM_VALUE9287 = 33;
+ ENUM_VALUE9288 = 34;
+ ENUM_VALUE9289 = 35;
+ ENUM_VALUE9290 = 36;
+ ENUM_VALUE9291 = 37;
+ ENUM_VALUE9292 = 38;
+ ENUM_VALUE9293 = 39;
+ ENUM_VALUE9294 = 40;
+ ENUM_VALUE9295 = 41;
+ ENUM_VALUE9296 = 42;
+ ENUM_VALUE9297 = 43;
+ ENUM_VALUE9298 = 44;
+ ENUM_VALUE9299 = 45;
+ ENUM_VALUE9300 = 46;
+ ENUM_VALUE9301 = 47;
+ ENUM_VALUE9302 = 48;
+ ENUM_VALUE9303 = 49;
+ ENUM_VALUE9304 = 50;
+ ENUM_VALUE9305 = 51;
+ ENUM_VALUE9306 = 52;
+ ENUM_VALUE9307 = 53;
+ ENUM_VALUE9308 = 54;
+ ENUM_VALUE9309 = 55;
+ ENUM_VALUE9310 = 56;
+ ENUM_VALUE9311 = 57;
+ ENUM_VALUE9312 = 58;
+ ENUM_VALUE9313 = 59;
+ ENUM_VALUE9314 = 60;
+ ENUM_VALUE9315 = 68;
+ ENUM_VALUE9316 = 69;
+ ENUM_VALUE9317 = 70;
+ ENUM_VALUE9318 = 1000;
+ ENUM_VALUE9319 = 1001;
+ ENUM_VALUE9320 = 1002;
+ ENUM_VALUE9321 = 1003;
+ ENUM_VALUE9322 = 1004;
+ ENUM_VALUE9323 = 1005;
+ ENUM_VALUE9324 = 1006;
+ ENUM_VALUE9325 = 1007;
+ ENUM_VALUE9326 = 65;
+}
+
+enum Enum10157 {
+ ENUM_VALUE10158 = 0;
+ ENUM_VALUE10159 = 1;
+ ENUM_VALUE10160 = 2;
+ ENUM_VALUE10161 = 3;
+ ENUM_VALUE10162 = 4;
+ ENUM_VALUE10163 = 5;
+ ENUM_VALUE10164 = 6;
+ ENUM_VALUE10165 = 7;
+ ENUM_VALUE10166 = 8;
+}
+
+enum Enum10167 {
+ ENUM_VALUE10168 = 0;
+ ENUM_VALUE10169 = 1;
+ ENUM_VALUE10170 = 2;
+ ENUM_VALUE10171 = 3;
+ ENUM_VALUE10172 = 4;
+ ENUM_VALUE10173 = 5;
+ ENUM_VALUE10174 = 6;
+ ENUM_VALUE10175 = 7;
+ ENUM_VALUE10176 = 8;
+}
+
+enum Enum8862 {
+ ENUM_VALUE8863 = 0;
+ ENUM_VALUE8864 = 1;
+ ENUM_VALUE8865 = 2;
+ ENUM_VALUE8866 = 3;
+ ENUM_VALUE8867 = 4;
+ ENUM_VALUE8868 = 5;
+ ENUM_VALUE8869 = 6;
+ ENUM_VALUE8870 = 7;
+ ENUM_VALUE8871 = 13;
+ ENUM_VALUE8872 = 14;
+ ENUM_VALUE8873 = 8;
+ ENUM_VALUE8874 = 9;
+ ENUM_VALUE8875 = 10;
+ ENUM_VALUE8876 = 11;
+ ENUM_VALUE8877 = 12;
+ ENUM_VALUE8878 = 15;
+}
+
+enum Enum10325 {
+ ENUM_VALUE10326 = 0;
+ ENUM_VALUE10327 = 1;
+ ENUM_VALUE10328 = 2;
+ ENUM_VALUE10329 = 3;
+ ENUM_VALUE10330 = 4;
+ ENUM_VALUE10331 = 5;
+ ENUM_VALUE10332 = 6;
+ ENUM_VALUE10333 = 7;
+ ENUM_VALUE10334 = 8;
+}
+
+enum Enum10335 {
+ ENUM_VALUE10336 = 0;
+}
+
+enum Enum10337 {
+ ENUM_VALUE10338 = 0;
+ ENUM_VALUE10339 = 1;
+}
+
+enum Enum10392 {
+ ENUM_VALUE10393 = 0;
+ ENUM_VALUE10394 = 1;
+ ENUM_VALUE10395 = 2;
+ ENUM_VALUE10396 = 3;
+ ENUM_VALUE10397 = 4;
+ ENUM_VALUE10398 = 5;
+ ENUM_VALUE10399 = 6;
+ ENUM_VALUE10400 = 7;
+ ENUM_VALUE10401 = 8;
+ ENUM_VALUE10402 = 15;
+ ENUM_VALUE10403 = 9;
+ ENUM_VALUE10404 = 10;
+ ENUM_VALUE10405 = 11;
+ ENUM_VALUE10406 = 12;
+ ENUM_VALUE10407 = 13;
+ ENUM_VALUE10408 = 14;
+ ENUM_VALUE10409 = 101;
+ ENUM_VALUE10410 = 102;
+}
+
+enum Enum11107 {
+ ENUM_VALUE11108 = 0;
+ ENUM_VALUE11109 = 1;
+ ENUM_VALUE11110 = 2;
+ ENUM_VALUE11111 = 3;
+ ENUM_VALUE11112 = 4;
+ ENUM_VALUE11113 = 5;
+ ENUM_VALUE11114 = 6;
+ ENUM_VALUE11115 = 7;
+ ENUM_VALUE11116 = 8;
+ ENUM_VALUE11117 = 9;
+ ENUM_VALUE11118 = 10;
+ ENUM_VALUE11119 = 11;
+ ENUM_VALUE11120 = 12;
+ ENUM_VALUE11121 = 13;
+ ENUM_VALUE11122 = 14;
+ ENUM_VALUE11123 = 15;
+ ENUM_VALUE11124 = 16;
+ ENUM_VALUE11125 = 17;
+ ENUM_VALUE11126 = 18;
+ ENUM_VALUE11127 = 19;
+ ENUM_VALUE11128 = 20;
+ ENUM_VALUE11129 = 21;
+ ENUM_VALUE11130 = 22;
+ ENUM_VALUE11131 = 23;
+ ENUM_VALUE11132 = 24;
+ ENUM_VALUE11133 = 25;
+ ENUM_VALUE11134 = 26;
+ ENUM_VALUE11135 = 27;
+ ENUM_VALUE11136 = 28;
+ ENUM_VALUE11137 = 29;
+ ENUM_VALUE11138 = 30;
+ ENUM_VALUE11139 = 31;
+ ENUM_VALUE11140 = 32;
+ ENUM_VALUE11141 = 33;
+ ENUM_VALUE11142 = 34;
+ ENUM_VALUE11143 = 35;
+ ENUM_VALUE11144 = 36;
+ ENUM_VALUE11145 = 37;
+ ENUM_VALUE11146 = 38;
+ ENUM_VALUE11147 = 39;
+ ENUM_VALUE11148 = 40;
+ ENUM_VALUE11149 = 41;
+ ENUM_VALUE11150 = 42;
+ ENUM_VALUE11151 = 43;
+ ENUM_VALUE11152 = 44;
+ ENUM_VALUE11153 = 45;
+ ENUM_VALUE11154 = 46;
+ ENUM_VALUE11155 = 47;
+ ENUM_VALUE11156 = 48;
+ ENUM_VALUE11157 = 49;
+ ENUM_VALUE11158 = 50;
+ ENUM_VALUE11159 = 51;
+ ENUM_VALUE11160 = 52;
+ ENUM_VALUE11161 = 53;
+ ENUM_VALUE11162 = 54;
+ ENUM_VALUE11163 = 55;
+ ENUM_VALUE11164 = 56;
+ ENUM_VALUE11165 = 57;
+ ENUM_VALUE11166 = 58;
+ ENUM_VALUE11167 = 59;
+ ENUM_VALUE11168 = 60;
+ ENUM_VALUE11169 = 61;
+ ENUM_VALUE11170 = 62;
+ ENUM_VALUE11171 = 63;
+ ENUM_VALUE11172 = 64;
+ ENUM_VALUE11173 = 65;
+ ENUM_VALUE11174 = 66;
+ ENUM_VALUE11175 = 67;
+ ENUM_VALUE11176 = 68;
+ ENUM_VALUE11177 = 69;
+ ENUM_VALUE11178 = 70;
+ ENUM_VALUE11179 = 71;
+ ENUM_VALUE11180 = 72;
+ ENUM_VALUE11181 = 73;
+ ENUM_VALUE11182 = 74;
+ ENUM_VALUE11183 = 75;
+ ENUM_VALUE11184 = 76;
+ ENUM_VALUE11185 = 77;
+ ENUM_VALUE11186 = 78;
+ ENUM_VALUE11187 = 79;
+ ENUM_VALUE11188 = 80;
+ ENUM_VALUE11189 = 81;
+ ENUM_VALUE11190 = 82;
+ ENUM_VALUE11191 = 83;
+ ENUM_VALUE11192 = 84;
+ ENUM_VALUE11193 = 85;
+ ENUM_VALUE11194 = 86;
+ ENUM_VALUE11195 = 87;
+ ENUM_VALUE11196 = 88;
+ ENUM_VALUE11197 = 89;
+ ENUM_VALUE11198 = 90;
+ ENUM_VALUE11199 = 91;
+ ENUM_VALUE11200 = 92;
+ ENUM_VALUE11201 = 93;
+ ENUM_VALUE11202 = 94;
+ ENUM_VALUE11203 = 95;
+ ENUM_VALUE11204 = 96;
+ ENUM_VALUE11205 = 97;
+ ENUM_VALUE11206 = 98;
+ ENUM_VALUE11207 = 99;
+ ENUM_VALUE11208 = 100;
+ ENUM_VALUE11209 = 101;
+ ENUM_VALUE11210 = 102;
+ ENUM_VALUE11211 = 103;
+ ENUM_VALUE11212 = 104;
+ ENUM_VALUE11213 = 105;
+ ENUM_VALUE11214 = 106;
+ ENUM_VALUE11215 = 107;
+ ENUM_VALUE11216 = 108;
+ ENUM_VALUE11217 = 109;
+ ENUM_VALUE11218 = 110;
+ ENUM_VALUE11219 = 111;
+ ENUM_VALUE11220 = 112;
+ ENUM_VALUE11221 = 113;
+ ENUM_VALUE11222 = 114;
+ ENUM_VALUE11223 = 115;
+ ENUM_VALUE11224 = 116;
+ ENUM_VALUE11225 = 117;
+ ENUM_VALUE11226 = 118;
+ ENUM_VALUE11227 = 119;
+ ENUM_VALUE11228 = 120;
+ ENUM_VALUE11229 = 121;
+ ENUM_VALUE11230 = 122;
+ ENUM_VALUE11231 = 123;
+ ENUM_VALUE11232 = 124;
+ ENUM_VALUE11233 = 125;
+ ENUM_VALUE11234 = 126;
+ ENUM_VALUE11235 = 127;
+ ENUM_VALUE11236 = 128;
+ ENUM_VALUE11237 = 129;
+ ENUM_VALUE11238 = 130;
+ ENUM_VALUE11239 = 131;
+ ENUM_VALUE11240 = 132;
+ ENUM_VALUE11241 = 133;
+ ENUM_VALUE11242 = 134;
+ ENUM_VALUE11243 = 135;
+ ENUM_VALUE11244 = 136;
+ ENUM_VALUE11245 = 137;
+ ENUM_VALUE11246 = 138;
+ ENUM_VALUE11247 = 139;
+ ENUM_VALUE11248 = 140;
+ ENUM_VALUE11249 = 141;
+ ENUM_VALUE11250 = 142;
+ ENUM_VALUE11251 = 143;
+ ENUM_VALUE11252 = 144;
+ ENUM_VALUE11253 = 145;
+ ENUM_VALUE11254 = 146;
+ ENUM_VALUE11255 = 147;
+ ENUM_VALUE11256 = 148;
+ ENUM_VALUE11257 = 149;
+ ENUM_VALUE11258 = 150;
+ ENUM_VALUE11259 = 151;
+ ENUM_VALUE11260 = 152;
+ ENUM_VALUE11261 = 153;
+ ENUM_VALUE11262 = 154;
+ ENUM_VALUE11263 = 155;
+ ENUM_VALUE11264 = 156;
+ ENUM_VALUE11265 = 157;
+ ENUM_VALUE11266 = 158;
+ ENUM_VALUE11267 = 159;
+ ENUM_VALUE11268 = 160;
+ ENUM_VALUE11269 = 161;
+ ENUM_VALUE11270 = 163;
+ ENUM_VALUE11271 = 164;
+ ENUM_VALUE11272 = 165;
+ ENUM_VALUE11273 = 166;
+ ENUM_VALUE11274 = 167;
+ ENUM_VALUE11275 = 168;
+ ENUM_VALUE11276 = 169;
+ ENUM_VALUE11277 = 170;
+ ENUM_VALUE11278 = 171;
+ ENUM_VALUE11279 = 172;
+ ENUM_VALUE11280 = 173;
+ ENUM_VALUE11281 = 174;
+ ENUM_VALUE11282 = 175;
+ ENUM_VALUE11283 = 176;
+ ENUM_VALUE11284 = 177;
+ ENUM_VALUE11285 = 178;
+ ENUM_VALUE11286 = 179;
+ ENUM_VALUE11287 = 180;
+ ENUM_VALUE11288 = 181;
+ ENUM_VALUE11289 = 182;
+ ENUM_VALUE11290 = 183;
+ ENUM_VALUE11291 = 184;
+ ENUM_VALUE11292 = 185;
+ ENUM_VALUE11293 = 187;
+ ENUM_VALUE11294 = 188;
+ ENUM_VALUE11295 = 189;
+ ENUM_VALUE11296 = 190;
+ ENUM_VALUE11297 = 191;
+ ENUM_VALUE11298 = 192;
+ ENUM_VALUE11299 = 193;
+ ENUM_VALUE11300 = 194;
+ ENUM_VALUE11301 = 195;
+ ENUM_VALUE11302 = 196;
+ ENUM_VALUE11303 = 197;
+ ENUM_VALUE11304 = 198;
+ ENUM_VALUE11305 = 65535;
+ ENUM_VALUE11306 = 65536;
+ ENUM_VALUE11307 = 65537;
+ ENUM_VALUE11308 = 65538;
+ ENUM_VALUE11309 = 65539;
+ ENUM_VALUE11310 = 65540;
+ ENUM_VALUE11311 = 65541;
+ ENUM_VALUE11312 = 65542;
+ ENUM_VALUE11313 = 65543;
+ ENUM_VALUE11314 = 65544;
+ ENUM_VALUE11315 = 65545;
+ ENUM_VALUE11316 = 65546;
+ ENUM_VALUE11317 = 65547;
+ ENUM_VALUE11318 = 65548;
+ ENUM_VALUE11319 = 65549;
+ ENUM_VALUE11320 = 65550;
+ ENUM_VALUE11321 = 65551;
+ ENUM_VALUE11322 = 65552;
+ ENUM_VALUE11323 = 65553;
+ ENUM_VALUE11324 = 65554;
+ ENUM_VALUE11325 = 65555;
+ ENUM_VALUE11326 = 65556;
+ ENUM_VALUE11327 = 65557;
+ ENUM_VALUE11328 = 65558;
+ ENUM_VALUE11329 = 65559;
+ ENUM_VALUE11330 = 65560;
+ ENUM_VALUE11331 = 65561;
+ ENUM_VALUE11332 = 65562;
+ ENUM_VALUE11333 = 65563;
+ ENUM_VALUE11334 = 69632;
+ ENUM_VALUE11335 = 69633;
+ ENUM_VALUE11336 = 69634;
+ ENUM_VALUE11337 = 69635;
+ ENUM_VALUE11338 = 69636;
+ ENUM_VALUE11339 = 69637;
+ ENUM_VALUE11340 = 69638;
+ ENUM_VALUE11341 = 69639;
+ ENUM_VALUE11342 = 69640;
+ ENUM_VALUE11343 = 69641;
+ ENUM_VALUE11344 = 69642;
+ ENUM_VALUE11345 = 69643;
+ ENUM_VALUE11346 = 69644;
+ ENUM_VALUE11347 = 69645;
+ ENUM_VALUE11348 = 69646;
+ ENUM_VALUE11349 = 69647;
+ ENUM_VALUE11350 = 69648;
+ ENUM_VALUE11351 = 69649;
+ ENUM_VALUE11352 = 69650;
+ ENUM_VALUE11353 = 69651;
+ ENUM_VALUE11354 = 69652;
+ ENUM_VALUE11355 = 69653;
+ ENUM_VALUE11356 = 69654;
+ ENUM_VALUE11357 = 69655;
+ ENUM_VALUE11358 = 69656;
+ ENUM_VALUE11359 = 69657;
+ ENUM_VALUE11360 = 69658;
+ ENUM_VALUE11361 = 69659;
+ ENUM_VALUE11362 = 69660;
+ ENUM_VALUE11363 = 69661;
+ ENUM_VALUE11364 = 69662;
+ ENUM_VALUE11365 = 73728;
+ ENUM_VALUE11366 = 73729;
+ ENUM_VALUE11367 = 77824;
+ ENUM_VALUE11368 = 77825;
+ ENUM_VALUE11369 = 81920;
+ ENUM_VALUE11370 = 81921;
+ ENUM_VALUE11371 = 81922;
+ ENUM_VALUE11372 = 81923;
+ ENUM_VALUE11373 = 86016;
+ ENUM_VALUE11374 = 86017;
+ ENUM_VALUE11375 = 86018;
+ ENUM_VALUE11376 = 86019;
+ ENUM_VALUE11377 = 86020;
+ ENUM_VALUE11378 = 86021;
+ ENUM_VALUE11379 = 86022;
+ ENUM_VALUE11380 = 86023;
+ ENUM_VALUE11381 = 86024;
+ ENUM_VALUE11382 = 86025;
+ ENUM_VALUE11383 = 86026;
+ ENUM_VALUE11384 = 86027;
+ ENUM_VALUE11385 = 86028;
+ ENUM_VALUE11386 = 86029;
+ ENUM_VALUE11387 = 86030;
+ ENUM_VALUE11388 = 86031;
+ ENUM_VALUE11389 = 86032;
+ ENUM_VALUE11390 = 86033;
+ ENUM_VALUE11391 = 86034;
+ ENUM_VALUE11392 = 86035;
+ ENUM_VALUE11393 = 86036;
+ ENUM_VALUE11394 = 86037;
+ ENUM_VALUE11395 = 86038;
+ ENUM_VALUE11396 = 86039;
+ ENUM_VALUE11397 = 86040;
+ ENUM_VALUE11398 = 86041;
+ ENUM_VALUE11399 = 86042;
+ ENUM_VALUE11400 = 86043;
+ ENUM_VALUE11401 = 86044;
+ ENUM_VALUE11402 = 86045;
+ ENUM_VALUE11403 = 86046;
+ ENUM_VALUE11404 = 86047;
+ ENUM_VALUE11405 = 86048;
+ ENUM_VALUE11406 = 86049;
+ ENUM_VALUE11407 = 86050;
+ ENUM_VALUE11408 = 86051;
+ ENUM_VALUE11409 = 86052;
+ ENUM_VALUE11410 = 86053;
+ ENUM_VALUE11411 = 86054;
+ ENUM_VALUE11412 = 86055;
+ ENUM_VALUE11413 = 86056;
+ ENUM_VALUE11414 = 86057;
+ ENUM_VALUE11415 = 86058;
+ ENUM_VALUE11416 = 86059;
+ ENUM_VALUE11417 = 86060;
+ ENUM_VALUE11418 = 86061;
+ ENUM_VALUE11419 = 86062;
+ ENUM_VALUE11420 = 86063;
+ ENUM_VALUE11421 = 86064;
+ ENUM_VALUE11422 = 86065;
+ ENUM_VALUE11423 = 86066;
+ ENUM_VALUE11424 = 86067;
+ ENUM_VALUE11425 = 86068;
+ ENUM_VALUE11426 = 86069;
+ ENUM_VALUE11427 = 86070;
+ ENUM_VALUE11428 = 86071;
+ ENUM_VALUE11429 = 86072;
+ ENUM_VALUE11430 = 86073;
+ ENUM_VALUE11431 = 86074;
+ ENUM_VALUE11432 = 86077;
+ ENUM_VALUE11433 = 86078;
+ ENUM_VALUE11434 = 86079;
+ ENUM_VALUE11435 = 86080;
+ ENUM_VALUE11436 = 86081;
+ ENUM_VALUE11437 = 86082;
+ ENUM_VALUE11438 = 86083;
+ ENUM_VALUE11439 = 86084;
+ ENUM_VALUE11440 = 90112;
+ ENUM_VALUE11441 = 94208;
+ ENUM_VALUE11442 = 94209;
+ ENUM_VALUE11443 = 94210;
+ ENUM_VALUE11444 = 94211;
+ ENUM_VALUE11445 = 94212;
+ ENUM_VALUE11446 = 94213;
+ ENUM_VALUE11447 = 94214;
+ ENUM_VALUE11448 = 94215;
+ ENUM_VALUE11449 = 94216;
+ ENUM_VALUE11450 = 94217;
+ ENUM_VALUE11451 = 94218;
+ ENUM_VALUE11452 = 94219;
+ ENUM_VALUE11453 = 94220;
+ ENUM_VALUE11454 = 94221;
+ ENUM_VALUE11455 = 94222;
+ ENUM_VALUE11456 = 94223;
+ ENUM_VALUE11457 = 94224;
+ ENUM_VALUE11458 = 98304;
+ ENUM_VALUE11459 = 98305;
+ ENUM_VALUE11460 = 98306;
+ ENUM_VALUE11461 = 98307;
+ ENUM_VALUE11462 = 98308;
+ ENUM_VALUE11463 = 102400;
+ ENUM_VALUE11464 = 131072;
+ ENUM_VALUE11465 = 131073;
+ ENUM_VALUE11466 = 135168;
+ ENUM_VALUE11467 = 9439507;
+}
+
+enum Enum11541 {
+ ENUM_VALUE11542 = -1;
+ ENUM_VALUE11543 = 0;
+ ENUM_VALUE11544 = 1;
+ ENUM_VALUE11545 = 2;
+ ENUM_VALUE11546 = 3;
+ ENUM_VALUE11547 = 4;
+ ENUM_VALUE11548 = 5;
+ ENUM_VALUE11549 = 6;
+ ENUM_VALUE11550 = 7;
+ ENUM_VALUE11551 = 8;
+ ENUM_VALUE11552 = 9;
+ ENUM_VALUE11553 = 10;
+ ENUM_VALUE11554 = 11;
+ ENUM_VALUE11555 = 12;
+ ENUM_VALUE11556 = 13;
+ ENUM_VALUE11557 = 14;
+ ENUM_VALUE11558 = 15;
+ ENUM_VALUE11559 = 16;
+ ENUM_VALUE11560 = 17;
+ ENUM_VALUE11561 = 18;
+ ENUM_VALUE11562 = 19;
+ ENUM_VALUE11563 = 20;
+ ENUM_VALUE11564 = 21;
+ ENUM_VALUE11565 = 22;
+ ENUM_VALUE11566 = 23;
+ ENUM_VALUE11567 = 24;
+ ENUM_VALUE11568 = 25;
+ ENUM_VALUE11569 = 26;
+ ENUM_VALUE11570 = 27;
+ ENUM_VALUE11571 = 28;
+ ENUM_VALUE11572 = 29;
+ ENUM_VALUE11573 = 30;
+ ENUM_VALUE11574 = 31;
+ ENUM_VALUE11575 = 32;
+ ENUM_VALUE11576 = 33;
+ ENUM_VALUE11577 = 34;
+ ENUM_VALUE11578 = 35;
+ ENUM_VALUE11579 = 36;
+ ENUM_VALUE11580 = 37;
+ ENUM_VALUE11581 = 38;
+ ENUM_VALUE11582 = 39;
+ ENUM_VALUE11583 = 40;
+ ENUM_VALUE11584 = 41;
+ ENUM_VALUE11585 = 42;
+ ENUM_VALUE11586 = 43;
+ ENUM_VALUE11587 = 44;
+ ENUM_VALUE11588 = 45;
+ ENUM_VALUE11589 = 46;
+ ENUM_VALUE11590 = 47;
+ ENUM_VALUE11591 = 48;
+ ENUM_VALUE11592 = 49;
+ ENUM_VALUE11593 = 50;
+ ENUM_VALUE11594 = 51;
+ ENUM_VALUE11595 = 52;
+ ENUM_VALUE11596 = 53;
+ ENUM_VALUE11597 = 54;
+ ENUM_VALUE11598 = 55;
+ ENUM_VALUE11599 = 56;
+ ENUM_VALUE11600 = 57;
+ ENUM_VALUE11601 = 58;
+ ENUM_VALUE11602 = 59;
+ ENUM_VALUE11603 = 60;
+ ENUM_VALUE11604 = 61;
+ ENUM_VALUE11605 = 62;
+ ENUM_VALUE11606 = 63;
+ ENUM_VALUE11607 = 64;
+ ENUM_VALUE11608 = 65;
+ ENUM_VALUE11609 = 66;
+ ENUM_VALUE11610 = 67;
+ ENUM_VALUE11611 = 68;
+ ENUM_VALUE11612 = 69;
+ ENUM_VALUE11613 = 70;
+ ENUM_VALUE11614 = 71;
+ ENUM_VALUE11615 = 72;
+ ENUM_VALUE11616 = 73;
+ ENUM_VALUE11617 = 74;
+ ENUM_VALUE11618 = 75;
+ ENUM_VALUE11619 = 76;
+ ENUM_VALUE11620 = 77;
+ ENUM_VALUE11621 = 78;
+ ENUM_VALUE11622 = 79;
+ ENUM_VALUE11623 = 80;
+ ENUM_VALUE11624 = 81;
+ ENUM_VALUE11625 = 82;
+ ENUM_VALUE11626 = 83;
+ ENUM_VALUE11627 = 84;
+ ENUM_VALUE11628 = 85;
+ ENUM_VALUE11629 = 86;
+ ENUM_VALUE11630 = 87;
+ ENUM_VALUE11631 = 88;
+ ENUM_VALUE11632 = 89;
+ ENUM_VALUE11633 = 90;
+ ENUM_VALUE11634 = 91;
+ ENUM_VALUE11635 = 92;
+ ENUM_VALUE11636 = 93;
+ ENUM_VALUE11637 = 94;
+ ENUM_VALUE11638 = 95;
+ ENUM_VALUE11639 = 96;
+ ENUM_VALUE11640 = 97;
+ ENUM_VALUE11641 = 98;
+ ENUM_VALUE11642 = 99;
+ ENUM_VALUE11643 = 100;
+ ENUM_VALUE11644 = 101;
+ ENUM_VALUE11645 = 102;
+ ENUM_VALUE11646 = 103;
+ ENUM_VALUE11647 = 104;
+ ENUM_VALUE11648 = 105;
+ ENUM_VALUE11649 = 106;
+ ENUM_VALUE11650 = 107;
+ ENUM_VALUE11651 = 108;
+ ENUM_VALUE11652 = 109;
+ ENUM_VALUE11653 = 110;
+ ENUM_VALUE11654 = 111;
+ ENUM_VALUE11655 = 112;
+ ENUM_VALUE11656 = 113;
+ ENUM_VALUE11657 = 114;
+ ENUM_VALUE11658 = 115;
+ ENUM_VALUE11659 = 116;
+ ENUM_VALUE11660 = 117;
+ ENUM_VALUE11661 = 118;
+ ENUM_VALUE11662 = 119;
+ ENUM_VALUE11663 = 120;
+ ENUM_VALUE11664 = 121;
+ ENUM_VALUE11665 = 122;
+ ENUM_VALUE11666 = 123;
+ ENUM_VALUE11667 = 124;
+ ENUM_VALUE11668 = 125;
+ ENUM_VALUE11669 = 126;
+ ENUM_VALUE11670 = 127;
+ ENUM_VALUE11671 = 128;
+ ENUM_VALUE11672 = 129;
+ ENUM_VALUE11673 = 130;
+ ENUM_VALUE11674 = 131;
+ ENUM_VALUE11675 = 132;
+ ENUM_VALUE11676 = 133;
+ ENUM_VALUE11677 = 134;
+ ENUM_VALUE11678 = 135;
+ ENUM_VALUE11679 = 136;
+ ENUM_VALUE11680 = 137;
+ ENUM_VALUE11681 = 138;
+ ENUM_VALUE11682 = 139;
+ ENUM_VALUE11683 = 140;
+ ENUM_VALUE11684 = 141;
+ ENUM_VALUE11685 = 142;
+ ENUM_VALUE11686 = 143;
+ ENUM_VALUE11687 = 144;
+ ENUM_VALUE11688 = 145;
+ ENUM_VALUE11689 = 146;
+ ENUM_VALUE11690 = 147;
+ ENUM_VALUE11691 = 148;
+ ENUM_VALUE11692 = 149;
+ ENUM_VALUE11693 = 150;
+ ENUM_VALUE11694 = 151;
+ ENUM_VALUE11695 = 152;
+ ENUM_VALUE11696 = 153;
+ ENUM_VALUE11697 = 154;
+ ENUM_VALUE11698 = 155;
+ ENUM_VALUE11699 = 156;
+ ENUM_VALUE11700 = 157;
+ ENUM_VALUE11701 = 158;
+ ENUM_VALUE11702 = 159;
+ ENUM_VALUE11703 = 160;
+ ENUM_VALUE11704 = 161;
+ ENUM_VALUE11705 = 162;
+ ENUM_VALUE11706 = 163;
+ ENUM_VALUE11707 = 164;
+ ENUM_VALUE11708 = 165;
+ ENUM_VALUE11709 = 166;
+ ENUM_VALUE11710 = 167;
+ ENUM_VALUE11711 = 168;
+ ENUM_VALUE11712 = 169;
+ ENUM_VALUE11713 = 170;
+ ENUM_VALUE11714 = 171;
+ ENUM_VALUE11715 = 172;
+ ENUM_VALUE11716 = 173;
+ ENUM_VALUE11717 = 174;
+ ENUM_VALUE11718 = 175;
+ ENUM_VALUE11719 = 176;
+ ENUM_VALUE11720 = 177;
+ ENUM_VALUE11721 = 178;
+ ENUM_VALUE11722 = 179;
+ ENUM_VALUE11723 = 180;
+ ENUM_VALUE11724 = 181;
+ ENUM_VALUE11725 = 182;
+ ENUM_VALUE11726 = 183;
+ ENUM_VALUE11727 = 184;
+ ENUM_VALUE11728 = 185;
+ ENUM_VALUE11729 = 186;
+ ENUM_VALUE11730 = 187;
+ ENUM_VALUE11731 = 188;
+ ENUM_VALUE11732 = 16777215;
+}
+
+enum Enum11468 {
+ ENUM_VALUE11469 = -99;
+ ENUM_VALUE11470 = 0;
+ ENUM_VALUE11471 = 1;
+ ENUM_VALUE11472 = 2;
+ ENUM_VALUE11473 = 3;
+ ENUM_VALUE11474 = 4;
+ ENUM_VALUE11475 = 28;
+ ENUM_VALUE11476 = 22;
+ ENUM_VALUE11477 = 38;
+ ENUM_VALUE11478 = 512;
+ ENUM_VALUE11479 = 2048;
+ ENUM_VALUE11480 = 66;
+ ENUM_VALUE11481 = 578;
+ ENUM_VALUE11482 = 77;
+ ENUM_VALUE11483 = 88;
+ ENUM_VALUE11484 = 100;
+ ENUM_VALUE11485 = 110;
+ ENUM_VALUE11486 = 2158;
+ ENUM_VALUE11487 = 122;
+ ENUM_VALUE11488 = 2170;
+ ENUM_VALUE11489 = 144;
+ ENUM_VALUE11490 = 244;
+ ENUM_VALUE11491 = 2292;
+ ENUM_VALUE11492 = 44;
+}
+
+enum Enum11022 {
+ ENUM_VALUE11023 = 0;
+ ENUM_VALUE11024 = 1;
+ ENUM_VALUE11025 = 2;
+ ENUM_VALUE11026 = 3;
+ ENUM_VALUE11027 = 4;
+ ENUM_VALUE11028 = 5;
+ ENUM_VALUE11029 = 6;
+ ENUM_VALUE11030 = 7;
+ ENUM_VALUE11031 = 8;
+ ENUM_VALUE11032 = 9;
+ ENUM_VALUE11033 = 10;
+ ENUM_VALUE11034 = 11;
+ ENUM_VALUE11035 = 12;
+ ENUM_VALUE11036 = 13;
+ ENUM_VALUE11037 = 14;
+ ENUM_VALUE11038 = 15;
+ ENUM_VALUE11039 = 16;
+ ENUM_VALUE11040 = 17;
+ ENUM_VALUE11041 = 18;
+ ENUM_VALUE11042 = 19;
+ ENUM_VALUE11043 = 20;
+ ENUM_VALUE11044 = 21;
+ ENUM_VALUE11045 = 22;
+ ENUM_VALUE11046 = 23;
+ ENUM_VALUE11047 = 24;
+ ENUM_VALUE11048 = 25;
+ ENUM_VALUE11049 = 26;
+ ENUM_VALUE11050 = 27;
+ ENUM_VALUE11051 = 28;
+ ENUM_VALUE11052 = 29;
+ ENUM_VALUE11053 = 30;
+ ENUM_VALUE11054 = 31;
+ ENUM_VALUE11055 = 32;
+ ENUM_VALUE11056 = 33;
+ ENUM_VALUE11057 = 34;
+ ENUM_VALUE11058 = 35;
+ ENUM_VALUE11059 = 36;
+ ENUM_VALUE11060 = 37;
+ ENUM_VALUE11061 = 38;
+ ENUM_VALUE11062 = 39;
+ ENUM_VALUE11063 = 40;
+ ENUM_VALUE11064 = 41;
+ ENUM_VALUE11065 = 42;
+ ENUM_VALUE11066 = 43;
+ ENUM_VALUE11067 = 44;
+ ENUM_VALUE11068 = 45;
+ ENUM_VALUE11069 = 46;
+ ENUM_VALUE11070 = 47;
+ ENUM_VALUE11071 = 48;
+ ENUM_VALUE11072 = 49;
+ ENUM_VALUE11073 = 50;
+ ENUM_VALUE11074 = 51;
+ ENUM_VALUE11075 = 52;
+ ENUM_VALUE11076 = 53;
+ ENUM_VALUE11077 = 54;
+ ENUM_VALUE11078 = 55;
+ ENUM_VALUE11079 = 56;
+ ENUM_VALUE11080 = 57;
+ ENUM_VALUE11081 = 58;
+ ENUM_VALUE11082 = 59;
+ ENUM_VALUE11083 = 60;
+ ENUM_VALUE11084 = 61;
+ ENUM_VALUE11085 = 62;
+ ENUM_VALUE11086 = 63;
+ ENUM_VALUE11087 = 64;
+ ENUM_VALUE11088 = 65;
+ ENUM_VALUE11089 = 66;
+ ENUM_VALUE11090 = 67;
+ ENUM_VALUE11091 = 68;
+ ENUM_VALUE11092 = 69;
+ ENUM_VALUE11093 = 70;
+ ENUM_VALUE11094 = 71;
+ ENUM_VALUE11095 = 72;
+ ENUM_VALUE11096 = 73;
+ ENUM_VALUE11097 = 74;
+ ENUM_VALUE11098 = 75;
+ ENUM_VALUE11099 = 76;
+ ENUM_VALUE11100 = 77;
+ ENUM_VALUE11101 = 78;
+ ENUM_VALUE11102 = 79;
+ ENUM_VALUE11103 = 80;
+ ENUM_VALUE11104 = 81;
+ ENUM_VALUE11105 = 82;
+ ENUM_VALUE11106 = 83;
+}
+
+enum Enum12670 {
+ ENUM_VALUE12671 = 0;
+ ENUM_VALUE12672 = 1;
+ ENUM_VALUE12673 = 2;
+}
+
+enum Enum12871 {
+ ENUM_VALUE12872 = 1;
+ ENUM_VALUE12873 = 2;
+ ENUM_VALUE12874 = 3;
+ ENUM_VALUE12875 = 4;
+ ENUM_VALUE12876 = 5;
+ ENUM_VALUE12877 = 6;
+}
+
+enum Enum13092 {
+ ENUM_VALUE13093 = 1;
+ ENUM_VALUE13094 = 2;
+ ENUM_VALUE13095 = 3;
+}
+
+enum Enum13146 {
+ ENUM_VALUE13147 = 0;
+ ENUM_VALUE13148 = 1;
+ ENUM_VALUE13149 = 2;
+ ENUM_VALUE13150 = 3;
+}
+
+enum Enum16042 {
+ ENUM_VALUE16043 = 0;
+ ENUM_VALUE16044 = 1;
+ ENUM_VALUE16045 = 17;
+ ENUM_VALUE16046 = 273;
+ ENUM_VALUE16047 = 274;
+ ENUM_VALUE16048 = 4385;
+ ENUM_VALUE16049 = 4386;
+ ENUM_VALUE16050 = 4387;
+ ENUM_VALUE16051 = 4388;
+ ENUM_VALUE16052 = 4389;
+ ENUM_VALUE16053 = 4390;
+ ENUM_VALUE16054 = 4391;
+ ENUM_VALUE16055 = 4392;
+ ENUM_VALUE16056 = 4393;
+ ENUM_VALUE16057 = 276;
+ ENUM_VALUE16058 = 277;
+ ENUM_VALUE16059 = 18;
+ ENUM_VALUE16060 = 289;
+ ENUM_VALUE16061 = 291;
+ ENUM_VALUE16062 = 4657;
+ ENUM_VALUE16063 = 74513;
+ ENUM_VALUE16064 = 4658;
+ ENUM_VALUE16065 = 4659;
+ ENUM_VALUE16066 = 4660;
+ ENUM_VALUE16067 = 4661;
+ ENUM_VALUE16068 = 4662;
+ ENUM_VALUE16069 = 4663;
+ ENUM_VALUE16070 = 4664;
+ ENUM_VALUE16071 = 292;
+ ENUM_VALUE16072 = 4673;
+ ENUM_VALUE16073 = 4674;
+ ENUM_VALUE16074 = 293;
+ ENUM_VALUE16075 = 19;
+ ENUM_VALUE16076 = 20;
+ ENUM_VALUE16077 = 321;
+ ENUM_VALUE16078 = 5137;
+ ENUM_VALUE16079 = 5138;
+ ENUM_VALUE16080 = 5139;
+ ENUM_VALUE16081 = 5140;
+ ENUM_VALUE16082 = 5141;
+ ENUM_VALUE16083 = 5142;
+ ENUM_VALUE16084 = 82273;
+ ENUM_VALUE16085 = 82274;
+ ENUM_VALUE16086 = 82275;
+ ENUM_VALUE16087 = 82276;
+ ENUM_VALUE16088 = 82277;
+ ENUM_VALUE16089 = 82278;
+ ENUM_VALUE16090 = 5143;
+ ENUM_VALUE16091 = 5144;
+ ENUM_VALUE16092 = 5145;
+ ENUM_VALUE16093 = 5146;
+ ENUM_VALUE16094 = 82337;
+ ENUM_VALUE16095 = 5147;
+ ENUM_VALUE16096 = 5148;
+ ENUM_VALUE16097 = 322;
+ ENUM_VALUE16098 = 323;
+ ENUM_VALUE16099 = 324;
+ ENUM_VALUE16100 = 325;
+ ENUM_VALUE16101 = 326;
+ ENUM_VALUE16102 = 327;
+ ENUM_VALUE16103 = 328;
+ ENUM_VALUE16104 = 21;
+ ENUM_VALUE16105 = 337;
+ ENUM_VALUE16106 = 22;
+ ENUM_VALUE16107 = 23;
+ ENUM_VALUE16108 = 24;
+ ENUM_VALUE16109 = 2;
+ ENUM_VALUE16110 = 33;
+ ENUM_VALUE16111 = 34;
+ ENUM_VALUE16112 = 545;
+ ENUM_VALUE16113 = 8721;
+ ENUM_VALUE16114 = 8723;
+ ENUM_VALUE16115 = 8724;
+ ENUM_VALUE16116 = 546;
+ ENUM_VALUE16117 = 8739;
+ ENUM_VALUE16118 = 8740;
+ ENUM_VALUE16119 = 547;
+ ENUM_VALUE16120 = 548;
+ ENUM_VALUE16121 = 549;
+ ENUM_VALUE16122 = 550;
+ ENUM_VALUE16123 = 551;
+ ENUM_VALUE16124 = 552;
+ ENUM_VALUE16125 = 553;
+ ENUM_VALUE16126 = 35;
+ ENUM_VALUE16127 = 36;
+ ENUM_VALUE16128 = 37;
+ ENUM_VALUE16129 = 593;
+ ENUM_VALUE16130 = 594;
+ ENUM_VALUE16131 = 595;
+ ENUM_VALUE16132 = 596;
+ ENUM_VALUE16133 = 597;
+ ENUM_VALUE16134 = 38;
+ ENUM_VALUE16135 = 609;
+ ENUM_VALUE16136 = 610;
+ ENUM_VALUE16137 = 617;
+ ENUM_VALUE16138 = 614;
+ ENUM_VALUE16139 = 615;
+ ENUM_VALUE16140 = 616;
+ ENUM_VALUE16141 = 618;
+ ENUM_VALUE16142 = 620;
+ ENUM_VALUE16143 = 9937;
+ ENUM_VALUE16144 = 9938;
+ ENUM_VALUE16145 = 9939;
+ ENUM_VALUE16146 = 9940;
+ ENUM_VALUE16147 = 9941;
+ ENUM_VALUE16148 = 39;
+ ENUM_VALUE16149 = 40;
+ ENUM_VALUE16150 = 41;
+ ENUM_VALUE16151 = 42;
+ ENUM_VALUE16152 = 43;
+ ENUM_VALUE16153 = 44;
+ ENUM_VALUE16154 = 45;
+ ENUM_VALUE16155 = 11793;
+ ENUM_VALUE16156 = 3;
+ ENUM_VALUE16157 = 49;
+ ENUM_VALUE16158 = 50;
+ ENUM_VALUE16159 = 51;
+ ENUM_VALUE16160 = 817;
+ ENUM_VALUE16161 = 818;
+ ENUM_VALUE16162 = 819;
+ ENUM_VALUE16163 = 52;
+ ENUM_VALUE16164 = 833;
+ ENUM_VALUE16165 = 53;
+ ENUM_VALUE16166 = 54;
+ ENUM_VALUE16167 = 4;
+ ENUM_VALUE16168 = 1041;
+ ENUM_VALUE16169 = 16657;
+ ENUM_VALUE16170 = 16658;
+ ENUM_VALUE16171 = 16659;
+ ENUM_VALUE16172 = 16660;
+ ENUM_VALUE16173 = 16661;
+ ENUM_VALUE16174 = 1042;
+ ENUM_VALUE16175 = 16673;
+ ENUM_VALUE16176 = 1043;
+ ENUM_VALUE16177 = 16689;
+ ENUM_VALUE16178 = 16690;
+ ENUM_VALUE16179 = 16691;
+ ENUM_VALUE16180 = 16692;
+ ENUM_VALUE16181 = 16693;
+ ENUM_VALUE16182 = 16694;
+ ENUM_VALUE16183 = 16695;
+ ENUM_VALUE16184 = 1044;
+ ENUM_VALUE16185 = 16705;
+ ENUM_VALUE16186 = 16706;
+ ENUM_VALUE16187 = 16707;
+ ENUM_VALUE16188 = 16708;
+ ENUM_VALUE16189 = 16709;
+ ENUM_VALUE16190 = 16710;
+ ENUM_VALUE16191 = 16711;
+ ENUM_VALUE16192 = 16712;
+ ENUM_VALUE16193 = 16713;
+ ENUM_VALUE16194 = 1046;
+ ENUM_VALUE16195 = 16737;
+ ENUM_VALUE16196 = 1047;
+ ENUM_VALUE16197 = 16753;
+ ENUM_VALUE16198 = 268049;
+ ENUM_VALUE16199 = 268050;
+ ENUM_VALUE16200 = 268051;
+ ENUM_VALUE16201 = 268052;
+ ENUM_VALUE16202 = 1048;
+ ENUM_VALUE16203 = 16769;
+ ENUM_VALUE16204 = 16770;
+ ENUM_VALUE16205 = 16771;
+ ENUM_VALUE16206 = 16772;
+ ENUM_VALUE16207 = 16773;
+ ENUM_VALUE16208 = 1049;
+ ENUM_VALUE16209 = 1056;
+ ENUM_VALUE16210 = 1058;
+ ENUM_VALUE16211 = 1059;
+ ENUM_VALUE16212 = 1060;
+ ENUM_VALUE16213 = 1061;
+ ENUM_VALUE16214 = 5;
+ ENUM_VALUE16215 = 6;
+ ENUM_VALUE16216 = 97;
+ ENUM_VALUE16217 = 98;
+ ENUM_VALUE16218 = 99;
+ ENUM_VALUE16219 = 100;
+ ENUM_VALUE16220 = 101;
+ ENUM_VALUE16221 = 102;
+ ENUM_VALUE16222 = 103;
+ ENUM_VALUE16223 = 104;
+ ENUM_VALUE16224 = 105;
+ ENUM_VALUE16225 = 106;
+ ENUM_VALUE16226 = 108;
+ ENUM_VALUE16227 = 1729;
+ ENUM_VALUE16228 = 1730;
+ ENUM_VALUE16229 = 1731;
+ ENUM_VALUE16230 = 7;
+ ENUM_VALUE16231 = 8;
+ ENUM_VALUE16232 = 9;
+ ENUM_VALUE16233 = 10;
+ ENUM_VALUE16234 = 161;
+ ENUM_VALUE16235 = 2577;
+ ENUM_VALUE16236 = 41233;
+ ENUM_VALUE16237 = 41234;
+ ENUM_VALUE16238 = 2578;
+ ENUM_VALUE16239 = 2579;
+ ENUM_VALUE16240 = 41265;
+ ENUM_VALUE16241 = 2580;
+ ENUM_VALUE16242 = 2581;
+ ENUM_VALUE16243 = 41297;
+ ENUM_VALUE16244 = 41298;
+ ENUM_VALUE16245 = 41299;
+ ENUM_VALUE16246 = 41300;
+ ENUM_VALUE16247 = 2582;
+ ENUM_VALUE16248 = 2583;
+ ENUM_VALUE16249 = 2584;
+ ENUM_VALUE16250 = 162;
+ ENUM_VALUE16251 = 2593;
+ ENUM_VALUE16252 = 41489;
+ ENUM_VALUE16253 = 663825;
+ ENUM_VALUE16254 = 663826;
+ ENUM_VALUE16255 = 41490;
+ ENUM_VALUE16256 = 41491;
+ ENUM_VALUE16257 = 41492;
+ ENUM_VALUE16258 = 663873;
+ ENUM_VALUE16259 = 2594;
+ ENUM_VALUE16260 = 41505;
+ ENUM_VALUE16261 = 41506;
+ ENUM_VALUE16262 = 41507;
+ ENUM_VALUE16263 = 2595;
+ ENUM_VALUE16264 = 41521;
+ ENUM_VALUE16265 = 41522;
+ ENUM_VALUE16266 = 41523;
+ ENUM_VALUE16267 = 41524;
+ ENUM_VALUE16268 = 41525;
+ ENUM_VALUE16269 = 664401;
+ ENUM_VALUE16270 = 664402;
+ ENUM_VALUE16271 = 41526;
+ ENUM_VALUE16272 = 41527;
+ ENUM_VALUE16273 = 2596;
+ ENUM_VALUE16274 = 2597;
+ ENUM_VALUE16275 = 2598;
+ ENUM_VALUE16276 = 41569;
+ ENUM_VALUE16277 = 41570;
+ ENUM_VALUE16278 = 41571;
+ ENUM_VALUE16279 = 41572;
+ ENUM_VALUE16280 = 41573;
+ ENUM_VALUE16281 = 665169;
+ ENUM_VALUE16282 = 665170;
+ ENUM_VALUE16283 = 665171;
+ ENUM_VALUE16284 = 665172;
+ ENUM_VALUE16285 = 2599;
+ ENUM_VALUE16286 = 2600;
+ ENUM_VALUE16287 = 2601;
+ ENUM_VALUE16288 = 2603;
+ ENUM_VALUE16289 = 2604;
+ ENUM_VALUE16290 = 163;
+ ENUM_VALUE16291 = 2608;
+ ENUM_VALUE16292 = 2609;
+ ENUM_VALUE16293 = 2610;
+ ENUM_VALUE16294 = 2611;
+ ENUM_VALUE16295 = 2612;
+ ENUM_VALUE16296 = 164;
+ ENUM_VALUE16297 = 2625;
+ ENUM_VALUE16298 = 2626;
+ ENUM_VALUE16299 = 42017;
+ ENUM_VALUE16300 = 42018;
+ ENUM_VALUE16301 = 42019;
+ ENUM_VALUE16302 = 2627;
+ ENUM_VALUE16303 = 2628;
+ ENUM_VALUE16304 = 165;
+ ENUM_VALUE16305 = 2641;
+ ENUM_VALUE16306 = 42257;
+ ENUM_VALUE16307 = 42258;
+ ENUM_VALUE16308 = 2642;
+ ENUM_VALUE16309 = 2643;
+ ENUM_VALUE16310 = 2644;
+ ENUM_VALUE16311 = 2646;
+ ENUM_VALUE16312 = 2647;
+ ENUM_VALUE16313 = 42353;
+ ENUM_VALUE16314 = 2648;
+ ENUM_VALUE16315 = 2649;
+ ENUM_VALUE16316 = 2650;
+ ENUM_VALUE16317 = 2651;
+ ENUM_VALUE16318 = 2652;
+ ENUM_VALUE16319 = 2653;
+ ENUM_VALUE16320 = 2654;
+ ENUM_VALUE16321 = 42481;
+ ENUM_VALUE16322 = 42482;
+ ENUM_VALUE16323 = 42483;
+ ENUM_VALUE16324 = 166;
+ ENUM_VALUE16325 = 2657;
+ ENUM_VALUE16326 = 2658;
+ ENUM_VALUE16327 = 42529;
+ ENUM_VALUE16328 = 2659;
+ ENUM_VALUE16329 = 2660;
+ ENUM_VALUE16330 = 2661;
+ ENUM_VALUE16331 = 2662;
+ ENUM_VALUE16332 = 2663;
+ ENUM_VALUE16333 = 42609;
+ ENUM_VALUE16334 = 2664;
+ ENUM_VALUE16335 = 2665;
+ ENUM_VALUE16336 = 42753;
+ ENUM_VALUE16337 = 42754;
+ ENUM_VALUE16338 = 42755;
+ ENUM_VALUE16339 = 11;
+ ENUM_VALUE16340 = 177;
+ ENUM_VALUE16341 = 2833;
+ ENUM_VALUE16342 = 179;
+ ENUM_VALUE16343 = 180;
+ ENUM_VALUE16344 = 2881;
+ ENUM_VALUE16345 = 182;
+ ENUM_VALUE16346 = 183;
+ ENUM_VALUE16347 = 12;
+ ENUM_VALUE16348 = 3089;
+ ENUM_VALUE16349 = 194;
+ ENUM_VALUE16350 = 195;
+ ENUM_VALUE16351 = 196;
+ ENUM_VALUE16352 = 198;
+ ENUM_VALUE16353 = 3169;
+ ENUM_VALUE16354 = 199;
+ ENUM_VALUE16355 = 200;
+ ENUM_VALUE16356 = 208;
+ ENUM_VALUE16357 = 3329;
+ ENUM_VALUE16358 = 3330;
+ ENUM_VALUE16359 = 3331;
+ ENUM_VALUE16360 = 209;
+ ENUM_VALUE16361 = 210;
+ ENUM_VALUE16362 = 211;
+ ENUM_VALUE16363 = 3377;
+ ENUM_VALUE16364 = 3378;
+ ENUM_VALUE16365 = 3379;
+ ENUM_VALUE16366 = 3380;
+ ENUM_VALUE16367 = 3381;
+ ENUM_VALUE16368 = 865809;
+ ENUM_VALUE16369 = 865810;
+ ENUM_VALUE16370 = 865811;
+ ENUM_VALUE16371 = 865812;
+ ENUM_VALUE16372 = 865813;
+ ENUM_VALUE16373 = 865814;
+ ENUM_VALUE16374 = 865815;
+ ENUM_VALUE16375 = 865816;
+ ENUM_VALUE16376 = 865817;
+ ENUM_VALUE16377 = 865818;
+ ENUM_VALUE16378 = 865819;
+ ENUM_VALUE16379 = 865820;
+ ENUM_VALUE16380 = 865821;
+ ENUM_VALUE16381 = 865822;
+ ENUM_VALUE16382 = 865823;
+ ENUM_VALUE16383 = 865824;
+ ENUM_VALUE16384 = 865825;
+ ENUM_VALUE16385 = 865826;
+ ENUM_VALUE16386 = 865827;
+ ENUM_VALUE16387 = 865828;
+ ENUM_VALUE16388 = 865829;
+ ENUM_VALUE16389 = 212;
+ ENUM_VALUE16390 = 3393;
+ ENUM_VALUE16391 = 3394;
+ ENUM_VALUE16392 = 3395;
+ ENUM_VALUE16393 = 213;
+ ENUM_VALUE16394 = 214;
+ ENUM_VALUE16395 = 215;
+ ENUM_VALUE16396 = 3441;
+ ENUM_VALUE16397 = 3442;
+ ENUM_VALUE16398 = 216;
+ ENUM_VALUE16399 = 217;
+ ENUM_VALUE16400 = 3473;
+ ENUM_VALUE16401 = 3474;
+ ENUM_VALUE16402 = 3475;
+ ENUM_VALUE16403 = 254;
+ ENUM_VALUE16404 = 255;
+}
+
+enum Enum16553 {
+ ENUM_VALUE16554 = 0;
+ ENUM_VALUE16555 = 1;
+ ENUM_VALUE16556 = 2;
+ ENUM_VALUE16557 = 3;
+ ENUM_VALUE16558 = 4;
+ ENUM_VALUE16559 = 5;
+ ENUM_VALUE16560 = 6;
+ ENUM_VALUE16561 = 7;
+ ENUM_VALUE16562 = 8;
+ ENUM_VALUE16563 = 9;
+}
+
+enum Enum16728 {
+ ENUM_VALUE16729 = 1;
+ ENUM_VALUE16730 = 2;
+ ENUM_VALUE16731 = 3;
+}
+
+enum Enum16732 {
+ ENUM_VALUE16733 = 1;
+ ENUM_VALUE16734 = 2;
+ ENUM_VALUE16735 = 3;
+ ENUM_VALUE16736 = 4;
+ ENUM_VALUE16737 = 5;
+}
+
+enum Enum16738 {
+ ENUM_VALUE16739 = 1;
+ ENUM_VALUE16740 = 2;
+ ENUM_VALUE16741 = 3;
+ ENUM_VALUE16742 = 4;
+ ENUM_VALUE16743 = 5;
+ ENUM_VALUE16744 = 6;
+ ENUM_VALUE16745 = 7;
+}
+
+enum Enum16698 {
+ ENUM_VALUE16699 = -1;
+ ENUM_VALUE16700 = 100;
+ ENUM_VALUE16701 = 2;
+ ENUM_VALUE16702 = 0;
+ ENUM_VALUE16703 = 1;
+ ENUM_VALUE16704 = 4;
+ ENUM_VALUE16705 = 11;
+ ENUM_VALUE16706 = 12;
+ ENUM_VALUE16707 = 3;
+ ENUM_VALUE16708 = 5;
+ ENUM_VALUE16709 = 6;
+ ENUM_VALUE16710 = 7;
+ ENUM_VALUE16711 = 8;
+ ENUM_VALUE16712 = 9;
+ ENUM_VALUE16713 = 10;
+ ENUM_VALUE16714 = 13;
+ ENUM_VALUE16715 = 14;
+ ENUM_VALUE16716 = 15;
+ ENUM_VALUE16717 = 16;
+ ENUM_VALUE16718 = 18;
+ ENUM_VALUE16719 = 17;
+ ENUM_VALUE16720 = 19;
+ ENUM_VALUE16721 = 20;
+}
+
+enum Enum16819 {
+ ENUM_VALUE16820 = 0;
+ ENUM_VALUE16821 = 1;
+ ENUM_VALUE16822 = 2;
+ ENUM_VALUE16823 = 3;
+ ENUM_VALUE16824 = 4;
+ ENUM_VALUE16825 = 5;
+}
+
+enum Enum16925 {
+ ENUM_VALUE16926 = 0;
+ ENUM_VALUE16927 = 1;
+ ENUM_VALUE16928 = 2;
+ ENUM_VALUE16929 = 3;
+ ENUM_VALUE16930 = 4;
+ ENUM_VALUE16931 = 5;
+ ENUM_VALUE16932 = 6;
+ ENUM_VALUE16933 = 7;
+ ENUM_VALUE16934 = 8;
+ ENUM_VALUE16935 = 9;
+ ENUM_VALUE16936 = 10;
+ ENUM_VALUE16937 = 11;
+ ENUM_VALUE16938 = 12;
+ ENUM_VALUE16939 = 13;
+}
+
+enum Enum22854 {
+ ENUM_VALUE22855 = 0;
+ ENUM_VALUE22856 = 1;
+}
+
+enum Enum24361 {
+ ENUM_VALUE24362 = 0;
+ ENUM_VALUE24363 = 1;
+ ENUM_VALUE24364 = 2;
+ ENUM_VALUE24365 = 3;
+}
+
+enum Enum16891 {
+ ENUM_VALUE16892 = 0;
+ ENUM_VALUE16893 = 1;
+ ENUM_VALUE16894 = 2;
+ ENUM_VALUE16895 = 3;
+ ENUM_VALUE16896 = 4;
+ ENUM_VALUE16897 = 5;
+ ENUM_VALUE16898 = 6;
+ ENUM_VALUE16899 = 7;
+ ENUM_VALUE16900 = 8;
+ ENUM_VALUE16901 = 9;
+ ENUM_VALUE16902 = 10;
+ ENUM_VALUE16903 = 11;
+ ENUM_VALUE16904 = 12;
+ ENUM_VALUE16905 = 13;
+ ENUM_VALUE16906 = 14;
+ ENUM_VALUE16907 = 15;
+ ENUM_VALUE16908 = 16;
+ ENUM_VALUE16909 = 17;
+ ENUM_VALUE16910 = 18;
+ ENUM_VALUE16911 = 19;
+ ENUM_VALUE16912 = 20;
+ ENUM_VALUE16913 = 21;
+ ENUM_VALUE16914 = 22;
+ ENUM_VALUE16915 = 23;
+ ENUM_VALUE16916 = 24;
+ ENUM_VALUE16917 = 25;
+ ENUM_VALUE16918 = 26;
+ ENUM_VALUE16919 = 27;
+ ENUM_VALUE16920 = 28;
+ ENUM_VALUE16921 = 29;
+ ENUM_VALUE16922 = 30;
+ ENUM_VALUE16923 = 31;
+}
+
+enum Enum27361 {
+ ENUM_VALUE27362 = 0;
+ ENUM_VALUE27363 = 1;
+ ENUM_VALUE27364 = 2;
+ ENUM_VALUE27365 = 3;
+ ENUM_VALUE27366 = 4;
+}
+
+enum Enum33960 {
+ ENUM_VALUE33961 = 0;
+ ENUM_VALUE33962 = 1;
+ ENUM_VALUE33963 = 2;
+ ENUM_VALUE33964 = 3;
+ ENUM_VALUE33965 = 4;
+ ENUM_VALUE33966 = 5;
+ ENUM_VALUE33967 = 6;
+}
+
+enum Enum34388 {
+ ENUM_VALUE34389 = 1;
+}
+
+enum Enum35477 {
+ ENUM_VALUE35478 = 4;
+ ENUM_VALUE35479 = 3;
+ ENUM_VALUE35480 = 2;
+ ENUM_VALUE35481 = 1;
+ ENUM_VALUE35482 = 0;
+}
+
+enum Enum35507 {
+ ENUM_VALUE35508 = 0;
+ ENUM_VALUE35509 = 1;
+ ENUM_VALUE35510 = 2;
+ ENUM_VALUE35511 = 3;
+ ENUM_VALUE35512 = 4;
+ ENUM_VALUE35513 = 5;
+ ENUM_VALUE35514 = 6;
+ ENUM_VALUE35515 = 7;
+ ENUM_VALUE35516 = 8;
+ ENUM_VALUE35517 = 9;
+}
+
+enum Enum36860 {
+ ENUM_VALUE36861 = 0;
+ ENUM_VALUE36862 = 1;
+ ENUM_VALUE36863 = 2;
+ ENUM_VALUE36864 = 3;
+ ENUM_VALUE36865 = 4;
+ ENUM_VALUE36866 = 5;
+ ENUM_VALUE36867 = 6;
+ ENUM_VALUE36868 = 7;
+}
+
+enum Enum36890 {
+ ENUM_VALUE36891 = 0;
+ ENUM_VALUE36892 = 1;
+}
+
diff --git a/benchmarks/datasets/google_message4/benchmark_message4.proto b/benchmarks/datasets/google_message4/benchmark_message4.proto
new file mode 100644
index 00000000..3e528904
--- /dev/null
+++ b/benchmarks/datasets/google_message4/benchmark_message4.proto
@@ -0,0 +1,453 @@
+syntax = "proto2";
+
+import "datasets/google_message4/benchmark_message4_1.proto";
+import "datasets/google_message4/benchmark_message4_2.proto";
+import "datasets/google_message4/benchmark_message4_3.proto";
+package benchmarks.google_message4;
+
+option cc_enable_arenas = true;
+
+message GoogleMessage4 {
+ optional int32 field37503 = 1;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37504 = 2;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37505 = 3;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37506 = 4;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37507 = 5;
+ optional .benchmarks.google_message4.Message37489 field37508 = 6;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37509 = 7;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37510 = 8;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37511 = 9;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37512 = 10;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37513 = 11;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37514 = 12;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37515 = 13;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37516 = 14;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37517 = 15;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37518 = 16;
+}
+
+message Message37489 {
+ optional .benchmarks.google_message4.Message2517 field37534 = 3;
+ optional .benchmarks.google_message4.Message7330 field37535 = 4;
+ optional .benchmarks.google_message4.Message8815 field37536 = 6;
+ optional .benchmarks.google_message4.Message8817 field37537 = 7;
+ optional .benchmarks.google_message4.Message8835 field37538 = 8;
+ optional .benchmarks.google_message4.Message8848 field37539 = 9;
+ optional .benchmarks.google_message4.Message8856 field37540 = 11;
+ optional .benchmarks.google_message4.Message12717 field37541 = 15;
+ optional .benchmarks.google_message4.Message12748 field37542 = 20;
+ optional .benchmarks.google_message4.Message7319 field37543 = 22;
+ optional .benchmarks.google_message4.Message12908 field37544 = 24;
+ optional .benchmarks.google_message4.Message12910 field37545 = 25;
+ optional .benchmarks.google_message4.Message12960 field37546 = 30;
+ optional .benchmarks.google_message4.Message176 field37547 = 33;
+ optional .benchmarks.google_message4.Message13000 field37548 = 34;
+ optional .benchmarks.google_message4.Message13035 field37549 = 35;
+ optional .benchmarks.google_message4.Message37331 field37550 = 36;
+ optional .benchmarks.google_message4.Message37329 field37551 = 37;
+ optional .benchmarks.google_message4.Message37327 field37552 = 38;
+ optional .benchmarks.google_message4.Message37333 field37553 = 39;
+ optional .benchmarks.google_message4.Message37335 field37554 = 40;
+}
+
+message Message7319 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7321 = 1;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7322 = 7;
+}
+
+message Message12717 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field12719 = 1;
+ optional string field12720 = 2;
+ optional uint32 field12721 = 3;
+ optional .benchmarks.google_message4.Message11976 field12722 = 4;
+ repeated .benchmarks.google_message4.Message11948 field12723 = 5;
+ optional .benchmarks.google_message4.Message11947 field12724 = 6;
+ optional .benchmarks.google_message4.Message12687 field12725 = 7;
+ repeated .benchmarks.google_message4.Message11948 field12726 = 8;
+ optional int64 field12727 = 9;
+}
+
+message Message37331 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37367 = 4;
+ required .benchmarks.google_message4.Message37326 field37368 = 1;
+ required int64 field37369 = 2;
+ required bytes field37370 = 3;
+}
+
+message Message8815 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field8819 = 1;
+ repeated .benchmarks.google_message4.Message8768 field8820 = 2;
+ optional bool field8821 = 3;
+}
+
+message Message7330 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7332 = 1;
+ optional .benchmarks.google_message4.Message3069 field7333 = 2;
+ optional .benchmarks.google_message4.Message7320 field7334 = 3;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7335 = 4;
+ optional bool field7336 = 5;
+ optional int64 field7337 = 6;
+}
+
+message Message12960 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field12962 = 1;
+ optional .benchmarks.google_message4.Message12948 field12963 = 2;
+}
+
+message Message176 {
+ required string field408 = 1;
+ optional int32 field409 = 4;
+ optional string field410 = 50;
+ optional int32 field411 = 2;
+ optional uint64 field412 = 47;
+ optional string field413 = 56;
+ optional int32 field414 = 24;
+ optional string field415 = 21;
+ optional bytes field416 = 3;
+ optional string field417 = 57;
+ optional int32 field418 = 51;
+ optional float field419 = 7;
+ optional bool field420 = 5;
+ optional bool field421 = 28;
+ optional int32 field422 = 6;
+ repeated int32 field423 = 40;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field424 = 41;
+ optional bool field425 = 25;
+ optional uint64 field426 = 26;
+ optional int32 field427 = 38;
+ optional bytes field428 = 15;
+ optional bytes field429 = 55;
+ optional bytes field430 = 16;
+ optional bytes field431 = 23;
+ optional bool field432 = 33;
+ optional bytes field433 = 31;
+ optional bytes field434 = 32;
+ optional int32 field435 = 36;
+ optional uint64 field436 = 17;
+ optional int32 field437 = 45;
+ optional uint64 field438 = 18;
+ optional string field439 = 46;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field440 = 64;
+ optional int32 field441 = 39;
+ optional uint64 field442 = 48;
+ optional bytes field443 = 19;
+ optional bytes field444 = 42;
+ optional bytes field445 = 43;
+ optional string field446 = 44;
+ optional string field447 = 49;
+ optional int64 field448 = 20;
+ optional bool field449 = 53;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field450 = 54;
+ repeated .benchmarks.google_message4.UnusedEmptyMessage field451 = 22;
+ optional .benchmarks.google_message4.UnusedEnum field452 = 27;
+ optional int32 field453 = 29;
+ optional int32 field454 = 30;
+ optional .benchmarks.google_message4.UnusedEnum field455 = 37;
+ optional .benchmarks.google_message4.UnusedEnum field456 = 34;
+ optional int32 field457 = 35;
+ repeated group Message178 = 101 {
+ }
+ optional bool field459 = 52;
+ optional uint64 field460 = 58;
+ optional uint64 field461 = 59;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field462 = 60;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field463 = 61;
+ optional .benchmarks.google_message4.UnusedEnum field464 = 62;
+ repeated string field465 = 63;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field466 = 65;
+}
+
+message Message8817 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field8825 = 1;
+ repeated .benchmarks.google_message4.Message8768 field8826 = 2;
+ optional string field8827 = 3;
+}
+
+message Message8835 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field8837 = 1;
+ repeated string field8838 = 2;
+ optional .benchmarks.google_message4.UnusedEnum field8839 = 3;
+}
+
+message Message37333 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37372 = 3;
+ required .benchmarks.google_message4.Message37326 field37373 = 1;
+ optional uint64 field37374 = 2;
+}
+
+message Message13000 {
+ optional int64 field13015 = 1;
+ repeated .benchmarks.google_message4.Message12979 field13016 = 2;
+}
+
+message Message37335 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37376 = 4;
+ required .benchmarks.google_message4.Message37326 field37377 = 1;
+ required .benchmarks.google_message4.Message37173 field37378 = 2;
+ optional uint64 field37379 = 3;
+}
+
+message Message8848 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field8850 = 1;
+ optional string field8851 = 2;
+ optional bytes field8852 = 3;
+}
+
+message Message13035 {
+ optional int64 field13058 = 1;
+ repeated int64 field13059 = 2;
+}
+
+message Message8856 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field8858 = 1;
+ optional string field8859 = 2;
+}
+
+message Message12908 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field12912 = 1;
+ optional string field12913 = 2;
+ optional .benchmarks.google_message4.Message12799 field12914 = 3;
+ optional int64 field12915 = 4;
+ optional .benchmarks.google_message4.Message3804 field12916 = 5;
+ optional .benchmarks.google_message4.Message12870 field12917 = 6;
+}
+
+message Message12910 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field12920 = 1;
+ optional .benchmarks.google_message4.Message12818 field12921 = 2;
+ repeated .benchmarks.google_message4.Message12903 field12922 = 3;
+}
+
+message Message37327 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37347 = 11;
+ required .benchmarks.google_message4.Message37326 field37348 = 1;
+ optional bool field37349 = 2;
+ optional bool field37350 = 3;
+ optional bool field37351 = 4;
+ optional bool field37352 = 5;
+ optional bool field37353 = 6;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37354 = 7;
+ optional uint64 field37355 = 8;
+ optional bool field37356 = 9;
+ optional bool field37357 = 10;
+}
+
+message Message37329 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37359 = 6;
+ required .benchmarks.google_message4.Message37326 field37360 = 1;
+ required int64 field37361 = 2;
+ required int64 field37362 = 3;
+ optional bool field37363 = 4;
+}
+
+message Message2517 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field2519 = 1;
+ optional .benchmarks.google_message4.Message2356 field2520 = 2;
+ optional .benchmarks.google_message4.Message0 field2521 = 3;
+ optional .benchmarks.google_message4.Message2463 field2522 = 4;
+ repeated .benchmarks.google_message4.Message971 field2523 = 5;
+}
+
+message Message12748 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field12754 = 1;
+ optional string field12755 = 2;
+ optional string field12756 = 3;
+ optional .benchmarks.google_message4.Enum12735 field12757 = 4;
+}
+
+message Message12687 {
+ repeated .benchmarks.google_message4.Message12686 field12701 = 1;
+}
+
+message Message11948 {
+ optional string field11954 = 1;
+ repeated .benchmarks.google_message4.Message11949 field11955 = 2;
+ optional bool field11956 = 3;
+}
+
+message Message11976 {
+ repeated .benchmarks.google_message4.Message11975 field12002 = 1;
+}
+
+message Message7320 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7323 = 1;
+ optional .benchmarks.google_message4.Message7287 field7324 = 8;
+}
+
+message Message3069 {
+ optional .benchmarks.google_message4.Message3061 field3374 = 1;
+ optional bytes field3375 = 2;
+ repeated group Message3070 = 3 {
+ required .benchmarks.google_message4.Enum3071 field3378 = 4;
+ required bytes field3379 = 5;
+ }
+ extensions 10000 to 536870911;
+}
+
+message Message12948 {
+ repeated .benchmarks.google_message4.Message12949 field12958 = 1;
+}
+
+message Message8768 {
+ optional string field8782 = 1;
+ optional .benchmarks.google_message4.Message8572 field8783 = 2;
+ optional bool field8784 = 3;
+ repeated .benchmarks.google_message4.Message8774 field8785 = 4;
+ optional int64 field8786 = 5;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field8787 = 6;
+ optional string field8788 = 7;
+}
+
+message Message12979 {
+ required bytes field12981 = 1;
+ repeated string field12982 = 2;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field12983 = 3;
+ optional int64 field12984 = 4;
+ optional string field12985 = 5;
+ optional int32 field12986 = 6;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field12987 = 7;
+}
+
+message Message37173 {
+ optional string field37252 = 1;
+ optional int64 field37253 = 2;
+ optional .benchmarks.google_message4.UnusedEnum field37254 = 4;
+ optional bool field37255 = 5;
+ optional bool field37256 = 6;
+ optional bool field37257 = 7;
+ optional string field37258 = 8;
+ optional string field37259 = 9;
+ optional uint32 field37260 = 10;
+ optional fixed32 field37261 = 11;
+ optional string field37262 = 12;
+ optional string field37263 = 13;
+ optional string field37264 = 14;
+ optional int32 field37265 = 15;
+ optional int64 field37266 = 16;
+ optional int64 field37267 = 17;
+ optional int32 field37268 = 18;
+ optional int32 field37269 = 19;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37270 = 20;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37271 = 21;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37272 = 22;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37273 = 23;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field37274 = 24;
+ optional string field37275 = 25;
+ optional bool field37276 = 26;
+}
+
+message Message12799 {
+ required string field12809 = 1;
+ repeated fixed64 field12810 = 2;
+ repeated .benchmarks.google_message4.Message12776 field12811 = 8;
+ repeated int32 field12812 = 4;
+ repeated .benchmarks.google_message4.Message12798 field12813 = 5;
+ required int32 field12814 = 3;
+ optional int32 field12815 = 6;
+ optional .benchmarks.google_message4.Message12797 field12816 = 7;
+}
+
+message Message12870 {
+ required int32 field12879 = 1;
+ optional int32 field12880 = 7;
+ required int32 field12881 = 2;
+ optional uint64 field12882 = 3;
+ optional string field12883 = 2001;
+ optional fixed64 field12884 = 4;
+ repeated fixed64 field12885 = 14;
+ optional int32 field12886 = 9;
+ optional int64 field12887 = 18;
+ repeated .benchmarks.google_message4.Message12870 field12888 = 8;
+ optional int32 field12889 = 5;
+ optional uint64 field12890 = 6;
+ optional int32 field12891 = 10;
+ optional int32 field12892 = 11;
+ optional double field12893 = 12;
+ optional .benchmarks.google_message4.Message12825 field12894 = 13;
+ optional double field12895 = 15;
+ optional string field12896 = 16;
+ optional .benchmarks.google_message4.Enum12871 field12897 = 17;
+ optional int32 field12898 = 19;
+}
+
+message Message3804 {
+ required int64 field3818 = 1;
+ required bool field3819 = 2;
+ repeated .benchmarks.google_message4.Enum3805 field3820 = 4;
+ optional int32 field3821 = 5;
+ optional bool field3822 = 6;
+ optional int64 field3823 = 7;
+ optional .benchmarks.google_message4.Enum3783 field3824 = 8;
+}
+
+message Message12903 {
+ optional string field12905 = 1;
+ optional .benchmarks.google_message4.Message8587 field12906 = 2;
+ repeated .benchmarks.google_message4.Message8590 field12907 = 3;
+}
+
+message Message37326 {
+ required string field37345 = 1;
+ optional string field37346 = 2;
+}
+
+message Message2356 {
+ optional .benchmarks.google_message4.Message1374 field2368 = 121;
+ optional uint64 field2369 = 1;
+ optional int32 field2370 = 2;
+ optional int32 field2371 = 17;
+ required string field2372 = 3;
+ optional int32 field2373 = 7;
+ optional bytes field2374 = 8;
+ optional string field2375 = 4;
+ optional string field2376 = 101;
+ optional int32 field2377 = 102;
+ optional int32 field2378 = 103;
+ optional int32 field2379 = 104;
+ optional int32 field2380 = 113;
+ optional int32 field2381 = 114;
+ optional int32 field2382 = 115;
+ optional int32 field2383 = 117;
+ optional int32 field2384 = 118;
+ optional int32 field2385 = 119;
+ optional int32 field2386 = 105;
+ optional bytes field2387 = 5;
+ optional group Message2357 = 6 {
+ optional int64 field2399 = 9;
+ optional int32 field2400 = 10;
+ optional int32 field2401 = 11;
+ optional int32 field2402 = 12;
+ optional int32 field2403 = 13;
+ optional int32 field2404 = 116;
+ optional int32 field2405 = 106;
+ required bytes field2406 = 14;
+ optional int32 field2407 = 45;
+ optional int32 field2408 = 112;
+ optional bool field2409 = 122;
+ optional bytes field2410 = 124;
+ }
+ optional string field2389 = 120;
+ optional group Message2358 = 107 {
+ }
+ repeated group Message2359 = 40 {
+ }
+ optional int32 field2392 = 50;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field2393 = 60;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field2394 = 70;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field2395 = 80;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field2396 = 90;
+ optional string field2397 = 100;
+ optional string field2398 = 123;
+}
+
+message Message0 {
+ option message_set_wire_format = true;
+ extensions 4 to 2147483646;
+}
+
+message Message971 {
+ optional string field972 = 1;
+ optional int32 field973 = 2;
+ optional bool field974 = 3;
+}
+
diff --git a/benchmarks/datasets/google_message4/benchmark_message4_1.proto b/benchmarks/datasets/google_message4/benchmark_message4_1.proto
new file mode 100644
index 00000000..01b84203
--- /dev/null
+++ b/benchmarks/datasets/google_message4/benchmark_message4_1.proto
@@ -0,0 +1,473 @@
+syntax = "proto2";
+
+import "datasets/google_message4/benchmark_message4_2.proto";
+import "datasets/google_message4/benchmark_message4_3.proto";
+package benchmarks.google_message4;
+
+option cc_enable_arenas = true;
+
+message Message2463 {
+ repeated .benchmarks.google_message4.Message2462 field2498 = 1;
+}
+
+message Message12686 {
+ optional string field12699 = 1;
+ optional .benchmarks.google_message4.Message12685 field12700 = 2;
+}
+
+message Message11949 {
+}
+
+message Message11975 {
+ optional string field11992 = 1;
+ optional int32 field11993 = 2;
+ repeated .benchmarks.google_message4.Message10320 field11994 = 3;
+ optional .benchmarks.google_message4.Message11947 field11995 = 4;
+ optional .benchmarks.google_message4.Message11920 field11996 = 5;
+ optional bool field11997 = 6;
+ repeated string field11998 = 7;
+ optional float field11999 = 8;
+ repeated .benchmarks.google_message4.UnusedEnum field12000 = 9;
+ optional int32 field12001 = 11;
+}
+
+message Message7287 {
+ optional .benchmarks.google_message4.Message6133 field7311 = 1;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7312 = 8;
+ optional string field7313 = 3;
+ optional .benchmarks.google_message4.Message6643 field7314 = 4;
+ optional .benchmarks.google_message4.Enum7288 field7315 = 5;
+ optional bytes field7316 = 6;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7317 = 7;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7318 = 9;
+}
+
+message Message3061 {
+ optional string field3286 = 2;
+ optional int32 field3287 = 77;
+ optional string field3288 = 49;
+ required .benchmarks.google_message4.Message3046 field3289 = 3;
+ optional .benchmarks.google_message4.Message3046 field3290 = 58;
+ optional group Message3062 = 4 {
+ required int32 field3335 = 5;
+ optional int32 field3336 = 6;
+ optional int32 field3337 = 7;
+ }
+ optional .benchmarks.google_message4.Message3060 field3292 = 104;
+ optional int64 field3293 = 32;
+ optional int32 field3294 = 41;
+ optional group Message3063 = 13 {
+ required int32 field3338 = 14;
+ optional .benchmarks.google_message4.Enum2851 field3339 = 18;
+ optional int64 field3340 = 15;
+ optional int64 field3341 = 23;
+ }
+ optional .benchmarks.google_message4.Enum2834 field3296 = 94;
+ optional bool field3297 = 25;
+ optional bool field3298 = 50;
+ optional string field3299 = 89;
+ optional string field3300 = 91;
+ optional string field3301 = 105;
+ optional .benchmarks.google_message4.Message3050 field3302 = 53;
+ optional fixed64 field3303 = 51;
+ optional fixed64 field3304 = 106;
+ optional int32 field3305 = 60;
+ optional string field3306 = 44;
+ optional bytes field3307 = 81;
+ optional string field3308 = 70;
+ optional bytes field3309 = 45;
+ optional .benchmarks.google_message4.Enum2806 field3310 = 71;
+ optional int32 field3311 = 72;
+ optional bytes field3312 = 78;
+ optional int32 field3313 = 20;
+ repeated group Message3064 = 8 {
+ required .benchmarks.google_message4.Enum2602 field3342 = 9;
+ optional int32 field3343 = 92;
+ optional string field3344 = 10;
+ optional bytes field3345 = 11;
+ optional int32 field3346 = 12;
+ optional .benchmarks.google_message4.Message3060 field3347 = 98;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field3348 = 82;
+ optional .benchmarks.google_message4.Message3050 field3349 = 80;
+ optional fixed64 field3350 = 52;
+ optional int32 field3351 = 33;
+ optional string field3352 = 42;
+ optional string field3353 = 69;
+ optional bytes field3354 = 43;
+ optional .benchmarks.google_message4.Enum2806 field3355 = 73;
+ optional int32 field3356 = 74;
+ optional int32 field3357 = 90;
+ optional bytes field3358 = 79;
+ optional int32 field3359 = 19;
+ optional .benchmarks.google_message4.Enum2834 field3360 = 95;
+ }
+ optional .benchmarks.google_message4.UnusedEmptyMessage field3315 = 39;
+ optional int32 field3316 = 76;
+ optional group Message3065 = 63 {
+ }
+ optional .benchmarks.google_message4.Enum2806 field3318 = 54;
+ optional int32 field3319 = 46;
+ repeated string field3320 = 24;
+ optional fixed32 field3321 = 38;
+ optional bytes field3322 = 99;
+ optional fixed64 field3323 = 1;
+ optional fixed64 field3324 = 97;
+ repeated .benchmarks.google_message4.Message3040 field3325 = 16;
+ repeated .benchmarks.google_message4.Message3041 field3326 = 61;
+ optional group Message3066 = 21 {
+ optional int32 field3366 = 22;
+ optional int32 field3367 = 55;
+ optional int32 field3368 = 88;
+ optional int32 field3369 = 56;
+ optional int32 field3370 = 75;
+ optional int32 field3371 = 57;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field3372 = 85;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field3373 = 96;
+ }
+ optional .benchmarks.google_message4.UnusedEmptyMessage field3328 = 47;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field3329 = 48;
+ optional fixed64 field3330 = 40;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field3331 = 86;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field3332 = 59;
+ optional int32 field3333 = 17;
+}
+
+message Message12949 {
+}
+
+message Message8572 {
+ optional bytes field8647 = 1;
+ optional bytes field8648 = 3;
+ optional .benchmarks.google_message4.Message3886 field8649 = 4;
+ optional .benchmarks.google_message4.Message3919 field8650 = 57;
+ optional bool field8651 = 5;
+ optional int32 field8652 = 6;
+ optional int32 field8653 = 49;
+ optional .benchmarks.google_message4.Message7905 field8654 = 7;
+ optional int32 field8655 = 10;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field8656 = 11;
+ optional bool field8657 = 35;
+ optional bytes field8658 = 12;
+ optional string field8659 = 14;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field8660 = 13;
+ optional bytes field8661 = 15;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field8662 = 17;
+ optional int32 field8663 = 18;
+ optional int32 field8664 = 19;
+ optional bool field8665 = 20;
+ optional .benchmarks.google_message4.Enum3476 field8666 = 31;
+ optional bool field8667 = 36;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field8668 = 39;
+ optional bytes field8669 = 22;
+ optional int32 field8670 = 24;
+ optional .benchmarks.google_message4.Message3052 field8671 = 25;
+ optional bytes field8672 = 26;
+ optional bytes field8673 = 28;
+ optional int32 field8674 = 29;
+ optional bytes field8675 = 30;
+ optional bytes field8676 = 32;
+ optional string field8677 = 33;
+ optional int32 field8678 = 34;
+ optional int32 field8679 = 37;
+ optional double field8680 = 38;
+ optional double field8681 = 42;
+ optional .benchmarks.google_message4.Message3922 field8682 = 40;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field8683 = 43;
+ optional int64 field8684 = 44;
+ optional .benchmarks.google_message4.Message7929 field8685 = 45;
+ optional uint64 field8686 = 46;
+ optional uint32 field8687 = 48;
+ optional .benchmarks.google_message4.Message7843 field8688 = 47;
+ optional .benchmarks.google_message4.Message7864 field8689 = 50;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field8690 = 52;
+ optional bool field8691 = 58;
+ optional bool field8692 = 54;
+ optional string field8693 = 55;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field8694 = 41;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field8695 = 53;
+ optional .benchmarks.google_message4.Message8575 field8696 = 61;
+}
+
+message Message8774 {
+ optional string field8810 = 1;
+ optional string field8811 = 2;
+ optional string field8812 = 3;
+ optional string field8813 = 4;
+ optional string field8814 = 5;
+}
+
+message Message12776 {
+ optional string field12786 = 1;
+ optional fixed64 field12787 = 11;
+ optional int32 field12788 = 6;
+ optional int32 field12789 = 13;
+ optional int32 field12790 = 14;
+ optional int32 field12791 = 15;
+ optional int32 field12792 = 16;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field12793 = 8;
+ optional .benchmarks.google_message4.Message12774 field12794 = 10;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field12795 = 12;
+ extensions 2 to 2;
+ extensions 3 to 3;
+ extensions 4 to 4;
+ extensions 5 to 5;
+ extensions 7 to 7;
+ extensions 9 to 9;
+}
+
+message Message12798 {
+ optional int32 field12805 = 1;
+ optional int32 field12806 = 2;
+ optional .benchmarks.google_message4.Message12774 field12807 = 6;
+ optional bool field12808 = 7;
+}
+
+message Message12797 {
+ optional .benchmarks.google_message4.Message12796 field12802 = 1;
+ repeated .benchmarks.google_message4.Message12796 field12803 = 2;
+ optional string field12804 = 3;
+}
+
+message Message12825 {
+ repeated .benchmarks.google_message4.Message12818 field12862 = 1;
+ optional int32 field12863 = 2;
+ optional .benchmarks.google_message4.Message12819 field12864 = 3;
+ optional .benchmarks.google_message4.Message12820 field12865 = 4;
+ optional int32 field12866 = 5;
+ repeated .benchmarks.google_message4.Message12821 field12867 = 6;
+ repeated .benchmarks.google_message4.UnusedEmptyMessage field12868 = 7;
+}
+
+message Message8590 {
+}
+
+message Message8587 {
+}
+
+message Message1374 {
+ required string field1375 = 1;
+ optional string field1376 = 2;
+}
+
+message Message2462 {
+ required bytes field2496 = 1;
+ required double field2497 = 2;
+}
+
+message Message12685 {
+ repeated string field12692 = 1;
+ repeated string field12693 = 2;
+ optional int64 field12694 = 3;
+ optional uint32 field12695 = 4;
+ repeated string field12696 = 5;
+ optional string field12697 = 6;
+ optional string field12698 = 7;
+}
+
+message Message10320 {
+ optional .benchmarks.google_message4.Enum10335 field10347 = 1;
+ repeated .benchmarks.google_message4.Message10319 field10348 = 2;
+ optional int32 field10349 = 3;
+ optional int32 field10350 = 4;
+ optional int32 field10351 = 5;
+ optional int32 field10352 = 6;
+ optional .benchmarks.google_message4.Enum10337 field10353 = 7;
+}
+
+message Message11947 {
+ optional uint32 field11951 = 1;
+ optional bool field11952 = 2;
+ optional int32 field11953 = 3;
+}
+
+message Message11920 {
+ optional .benchmarks.google_message4.Enum11901 field11945 = 1;
+ optional .benchmarks.google_message4.UnusedEnum field11946 = 2;
+}
+
+message Message6643 {
+ optional .benchmarks.google_message4.UnusedEmptyMessage field6683 = 3;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field6684 = 4;
+ optional double field6685 = 5;
+ optional double field6686 = 6;
+ optional int32 field6687 = 1;
+ optional int32 field6688 = 2;
+ optional double field6689 = 9;
+ optional bytes field6690 = 10;
+ optional int32 field6691 = 11;
+ optional bool field6692 = 12;
+ optional bool field6693 = 13;
+ optional .benchmarks.google_message4.Message6578 field6694 = 15;
+ optional .benchmarks.google_message4.UnusedEnum field6695 = 16;
+ optional int64 field6696 = 17;
+ repeated .benchmarks.google_message4.UnusedEmptyMessage field6697 = 22;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field6698 = 19;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field6699 = 20;
+ optional int32 field6700 = 21;
+}
+
+message Message6133 {
+ optional .benchmarks.google_message4.Message4016 field6173 = 12;
+ optional double field6174 = 16;
+ required string field6175 = 1;
+ required string field6176 = 2;
+ required string field6177 = 3;
+ optional string field6178 = 4;
+ optional string field6179 = 8;
+ repeated .benchmarks.google_message4.Message6109 field6180 = 5;
+ repeated .benchmarks.google_message4.Message5908 field6181 = 13;
+ repeated .benchmarks.google_message4.Message6107 field6182 = 7;
+ repeated .benchmarks.google_message4.Message6126 field6183 = 9;
+ repeated .benchmarks.google_message4.Message6129 field6184 = 15;
+ optional int32 field6185 = 10;
+ optional int32 field6186 = 11;
+ optional .benchmarks.google_message4.Message4016 field6187 = 17;
+ optional double field6188 = 14;
+ optional double field6189 = 18;
+ optional string field6190 = 19;
+ optional string field6191 = 20;
+ repeated .benchmarks.google_message4.Message5881 field6192 = 21;
+}
+
+message Message6109 {
+ optional string field6140 = 1;
+ required .benchmarks.google_message4.Enum6111 field6141 = 2;
+ optional int32 field6142 = 9;
+ optional string field6143 = 3;
+ repeated .benchmarks.google_message4.Message6110 field6144 = 4;
+ repeated int32 field6145 = 7;
+ repeated int32 field6146 = 8;
+ optional .benchmarks.google_message4.Message6133 field6147 = 10;
+ repeated int32 field6148 = 11;
+ optional string field6149 = 12;
+ optional string field6150 = 13;
+ optional bool field6151 = 14;
+ extensions 1000 to 536870911;
+}
+
+message Message3046 {
+ required .benchmarks.google_message4.Enum2593 field3222 = 1;
+ optional int32 field3223 = 4;
+}
+
+message Message3060 {
+ optional int64 field3283 = 1;
+ optional int64 field3284 = 2;
+ optional int64 field3285 = 3;
+}
+
+message Message3041 {
+ optional string field3214 = 1;
+ optional int32 field3215 = 2;
+}
+
+message Message3040 {
+ required fixed64 field3209 = 1;
+ repeated fixed64 field3210 = 4;
+ optional int32 field3211 = 5;
+ optional fixed64 field3212 = 2;
+ required string field3213 = 3;
+}
+
+message Message3050 {
+ optional bytes field3245 = 5;
+ optional int32 field3246 = 2;
+ optional bytes field3247 = 6;
+ optional int32 field3248 = 4;
+ optional fixed32 field3249 = 1;
+ optional fixed32 field3250 = 3;
+}
+
+message Message7905 {
+ optional int32 field7911 = 1;
+ optional bool field7912 = 2;
+ optional bytes field7913 = 3;
+ optional int32 field7914 = 4;
+ optional int32 field7915 = 5;
+ optional bytes field7916 = 6;
+ optional int32 field7917 = 7;
+}
+
+message Message3886 {
+ repeated group Message3887 = 1 {
+ required string field3932 = 2;
+ optional string field3933 = 9;
+ optional .benchmarks.google_message4.Message3850 field3934 = 3;
+ optional bytes field3935 = 8;
+ }
+}
+
+message Message7864 {
+ optional string field7866 = 1;
+ optional string field7867 = 2;
+ repeated .benchmarks.google_message4.Message7865 field7868 = 5;
+ repeated .benchmarks.google_message4.Message7865 field7869 = 6;
+ repeated .benchmarks.google_message4.Message7865 field7870 = 7;
+ repeated .benchmarks.google_message4.UnusedEmptyMessage field7871 = 8;
+}
+
+message Message3922 {
+ optional uint64 field4012 = 1;
+}
+
+message Message3052 {
+ repeated string field3254 = 1;
+ repeated string field3255 = 2;
+ repeated bytes field3256 = 3;
+ repeated string field3257 = 4;
+ optional bool field3258 = 5;
+ optional int32 field3259 = 6;
+ optional int32 field3260 = 7;
+ optional string field3261 = 8;
+ optional string field3262 = 9;
+}
+
+message Message8575 {
+}
+
+message Message7843 {
+ optional bool field7844 = 5;
+ optional int32 field7845 = 1;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7846 = 22;
+ repeated int32 field7847 = 3;
+ repeated string field7848 = 11;
+ optional .benchmarks.google_message4.UnusedEnum field7849 = 15;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7850 = 6;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7851 = 14;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7852 = 10;
+ optional .benchmarks.google_message4.Message7511 field7853 = 13;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7854 = 16;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7855 = 17;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7856 = 19;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field7857 = 18;
+ optional .benchmarks.google_message4.UnusedEnum field7858 = 20;
+ optional int32 field7859 = 2;
+}
+
+message Message3919 {
+ repeated .benchmarks.google_message4.Message3920 field4009 = 1;
+}
+
+message Message7929 {
+ optional int64 field7942 = 1;
+ optional int64 field7943 = 4;
+ optional int64 field7944 = 5;
+ optional int64 field7945 = 12;
+ optional int64 field7946 = 13;
+ optional int64 field7947 = 18;
+ optional int64 field7948 = 6;
+ optional int64 field7949 = 7;
+ repeated .benchmarks.google_message4.Message7919 field7950 = 8;
+ repeated .benchmarks.google_message4.UnusedEmptyMessage field7951 = 20;
+ repeated .benchmarks.google_message4.Message7920 field7952 = 14;
+ repeated .benchmarks.google_message4.Message7921 field7953 = 15;
+ repeated .benchmarks.google_message4.Message7928 field7954 = 17;
+ optional int64 field7955 = 19;
+ optional bool field7956 = 2;
+ optional int64 field7957 = 3;
+ optional int64 field7958 = 9;
+ repeated .benchmarks.google_message4.UnusedEmptyMessage field7959 = 10;
+ repeated bytes field7960 = 11;
+ optional int64 field7961 = 16;
+}
+
diff --git a/benchmarks/datasets/google_message4/benchmark_message4_2.proto b/benchmarks/datasets/google_message4/benchmark_message4_2.proto
new file mode 100644
index 00000000..1c69b3c5
--- /dev/null
+++ b/benchmarks/datasets/google_message4/benchmark_message4_2.proto
@@ -0,0 +1,291 @@
+syntax = "proto2";
+
+import "datasets/google_message4/benchmark_message4_3.proto";
+package benchmarks.google_message4;
+
+option cc_enable_arenas = true;
+
+message Message12774 {
+ optional uint32 field12777 = 1;
+ optional uint32 field12778 = 2;
+ optional uint32 field12779 = 3;
+ optional uint32 field12780 = 4;
+ optional uint32 field12781 = 5;
+ optional bool field12782 = 6;
+}
+
+message Message12796 {
+ repeated fixed64 field12800 = 1;
+ optional uint64 field12801 = 2;
+}
+
+message Message12821 {
+ optional int32 field12848 = 1;
+ optional int32 field12849 = 2;
+ optional int32 field12850 = 3;
+ optional int32 field12851 = 4;
+ optional int32 field12852 = 5;
+}
+
+message Message12820 {
+ optional int32 field12840 = 1;
+ optional int32 field12841 = 2;
+ optional int32 field12842 = 3;
+ optional int32 field12843 = 8;
+ optional int32 field12844 = 4;
+ optional int32 field12845 = 5;
+ optional int32 field12846 = 6;
+ optional int32 field12847 = 7;
+}
+
+message Message12819 {
+ optional double field12834 = 1;
+ optional double field12835 = 2;
+ optional double field12836 = 3;
+ optional double field12837 = 4;
+ optional double field12838 = 5;
+ optional double field12839 = 6;
+}
+
+message Message12818 {
+ optional uint64 field12829 = 1;
+ optional int32 field12830 = 2;
+ optional int32 field12831 = 3;
+ optional int32 field12832 = 5;
+ repeated .benchmarks.google_message4.Message12817 field12833 = 4;
+}
+
+message Message10319 {
+ optional .benchmarks.google_message4.Enum10325 field10340 = 1;
+ optional int32 field10341 = 4;
+ optional int32 field10342 = 5;
+ optional bytes field10343 = 3;
+ optional string field10344 = 2;
+ optional string field10345 = 6;
+ optional string field10346 = 7;
+}
+
+message Message6578 {
+ optional .benchmarks.google_message4.Enum6579 field6632 = 1;
+ optional .benchmarks.google_message4.Enum6588 field6633 = 2;
+}
+
+message Message6126 {
+ required string field6152 = 1;
+ repeated .benchmarks.google_message4.Message6127 field6153 = 9;
+ optional int32 field6154 = 14;
+ optional bytes field6155 = 10;
+ optional .benchmarks.google_message4.Message6024 field6156 = 12;
+ optional int32 field6157 = 4;
+ optional string field6158 = 5;
+ optional int32 field6159 = 6;
+ repeated int32 field6160 = 2;
+ repeated int32 field6161 = 3;
+ repeated .benchmarks.google_message4.Message6052 field6162 = 7;
+ repeated .benchmarks.google_message4.UnusedEmptyMessage field6163 = 11;
+ optional .benchmarks.google_message4.Enum6065 field6164 = 15;
+ repeated .benchmarks.google_message4.Message6127 field6165 = 8;
+ optional bool field6166 = 13;
+ optional bool field6167 = 16;
+ optional bool field6168 = 18;
+ repeated .benchmarks.google_message4.Message6054 field6169 = 17;
+ optional int32 field6170 = 19;
+}
+
+message Message5881 {
+ required double field5897 = 1;
+ optional string field5898 = 5;
+ optional .benchmarks.google_message4.Message5861 field5899 = 2;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field5900 = 3;
+ optional .benchmarks.google_message4.Message5867 field5901 = 4;
+ optional .benchmarks.google_message4.Message5880 field5902 = 6;
+}
+
+message Message6110 {
+}
+
+message Message6107 {
+ optional .benchmarks.google_message4.Message4016 field6134 = 1;
+ optional int32 field6135 = 2;
+ optional string field6136 = 3;
+ repeated int32 field6137 = 4;
+ optional int32 field6138 = 5;
+ repeated .benchmarks.google_message4.Message6108 field6139 = 6;
+}
+
+message Message6129 {
+ required .benchmarks.google_message4.Enum6130 field6171 = 1;
+ required string field6172 = 2;
+}
+
+message Message5908 {
+ optional string field5971 = 1;
+ optional int32 field5972 = 2;
+ optional int32 field5973 = 3;
+ optional .benchmarks.google_message4.Enum5909 field5974 = 45;
+ optional .benchmarks.google_message4.Enum5912 field5975 = 4;
+ optional fixed32 field5976 = 50;
+ optional fixed32 field5977 = 5;
+ optional fixed32 field5978 = 6;
+ optional string field5979 = 7;
+ optional .benchmarks.google_message4.Enum5915 field5980 = 8;
+ optional .benchmarks.google_message4.Message5903 field5981 = 9;
+ optional .benchmarks.google_message4.Message5903 field5982 = 10;
+ optional .benchmarks.google_message4.Enum5920 field5983 = 11;
+ optional .benchmarks.google_message4.Enum5923 field5984 = 40;
+ optional .benchmarks.google_message4.Message5903 field5985 = 41;
+ optional .benchmarks.google_message4.Message5903 field5986 = 42;
+ optional .benchmarks.google_message4.Enum5928 field5987 = 47;
+ optional bool field5988 = 48;
+ repeated fixed32 field5989 = 49;
+ optional string field5990 = 12;
+ optional .benchmarks.google_message4.Message5903 field5991 = 13;
+ optional .benchmarks.google_message4.Message5903 field5992 = 14;
+ optional .benchmarks.google_message4.Message5903 field5993 = 15;
+ optional .benchmarks.google_message4.Message5903 field5994 = 16;
+ optional .benchmarks.google_message4.Message5903 field5995 = 32;
+ optional .benchmarks.google_message4.Message5903 field5996 = 33;
+ optional .benchmarks.google_message4.Message5903 field5997 = 34;
+ optional .benchmarks.google_message4.Message5903 field5998 = 35;
+ optional .benchmarks.google_message4.Enum5931 field5999 = 17;
+ optional .benchmarks.google_message4.Enum5935 field6000 = 18;
+ optional .benchmarks.google_message4.Enum5939 field6001 = 36;
+ optional .benchmarks.google_message4.Enum5939 field6002 = 37;
+ repeated int32 field6003 = 19;
+ optional uint32 field6004 = 20;
+ optional uint32 field6005 = 21;
+ optional uint32 field6006 = 22;
+ optional uint32 field6007 = 23;
+ optional .benchmarks.google_message4.Enum5946 field6008 = 24;
+ optional .benchmarks.google_message4.Enum5946 field6009 = 25;
+ optional .benchmarks.google_message4.Enum5946 field6010 = 26;
+ optional .benchmarks.google_message4.Enum5946 field6011 = 27;
+ optional fixed32 field6012 = 28;
+ optional fixed32 field6013 = 29;
+ optional fixed32 field6014 = 30;
+ optional fixed32 field6015 = 31;
+ optional int32 field6016 = 38;
+ optional float field6017 = 39;
+ optional .benchmarks.google_message4.Enum5957 field6018 = 43;
+ optional .benchmarks.google_message4.Message5907 field6019 = 44;
+ optional .benchmarks.google_message4.Enum5962 field6020 = 46;
+}
+
+message Message3850 {
+ optional .benchmarks.google_message4.Enum3851 field3924 = 2;
+ optional bool field3925 = 12;
+ optional int32 field3926 = 4;
+ optional bool field3927 = 10;
+ optional bool field3928 = 13;
+ optional bool field3929 = 14;
+}
+
+message Message7865 {
+}
+
+message Message7511 {
+ optional bool field7523 = 1;
+ optional .benchmarks.google_message4.Enum7512 field7524 = 2;
+ optional int32 field7525 = 3;
+ optional int32 field7526 = 4;
+ optional bool field7527 = 5;
+ optional int32 field7528 = 6;
+ optional int32 field7529 = 7;
+}
+
+message Message3920 {
+}
+
+message Message7928 {
+ optional string field7940 = 1;
+ optional int64 field7941 = 2;
+}
+
+message Message7921 {
+ optional int32 field7936 = 1;
+ optional int64 field7937 = 2;
+ optional float field7938 = 3;
+ optional .benchmarks.google_message4.Enum7922 field7939 = 4;
+}
+
+message Message7920 {
+ optional int64 field7934 = 1;
+ optional int64 field7935 = 2;
+}
+
+message Message7919 {
+ optional fixed64 field7931 = 1;
+ optional int64 field7932 = 2;
+ optional bytes field7933 = 3;
+}
+
+message Message12817 {
+ optional int32 field12826 = 1;
+ optional int32 field12827 = 2;
+ optional int32 field12828 = 3;
+}
+
+message Message6054 {
+ required string field6089 = 1;
+ optional string field6090 = 2;
+}
+
+message Message6127 {
+}
+
+message Message6052 {
+ required string field6084 = 1;
+ required bytes field6085 = 2;
+}
+
+message Message6024 {
+ optional .benchmarks.google_message4.Enum6025 field6048 = 1;
+ optional string field6049 = 2;
+ optional .benchmarks.google_message4.UnusedEmptyMessage field6050 = 3;
+}
+
+message Message5861 {
+ required .benchmarks.google_message4.Enum5862 field5882 = 1;
+ required string field5883 = 2;
+ optional bool field5884 = 3;
+ optional string field5885 = 4;
+}
+
+message Message5880 {
+ optional string field5896 = 1;
+}
+
+message Message5867 {
+ optional .benchmarks.google_message4.Enum5868 field5890 = 1;
+ optional string field5891 = 2;
+ optional .benchmarks.google_message4.Enum5873 field5892 = 3;
+ optional int32 field5893 = 4;
+ optional .benchmarks.google_message4.UnusedEnum field5894 = 5;
+ optional bool field5895 = 6;
+}
+
+message Message4016 {
+ required int32 field4017 = 1;
+ required int32 field4018 = 2;
+ required int32 field4019 = 3;
+ required int32 field4020 = 4;
+}
+
+message Message6108 {
+}
+
+message Message5907 {
+ optional .benchmarks.google_message4.Message5903 field5967 = 1;
+ optional .benchmarks.google_message4.Message5903 field5968 = 2;
+ optional .benchmarks.google_message4.Message5903 field5969 = 3;
+ optional .benchmarks.google_message4.Message5903 field5970 = 4;
+}
+
+message UnusedEmptyMessage {
+}
+
+message Message5903 {
+ required int32 field5965 = 1;
+ optional .benchmarks.google_message4.Enum5904 field5966 = 2;
+}
+
diff --git a/benchmarks/datasets/google_message4/benchmark_message4_3.proto b/benchmarks/datasets/google_message4/benchmark_message4_3.proto
new file mode 100644
index 00000000..b6fb1343
--- /dev/null
+++ b/benchmarks/datasets/google_message4/benchmark_message4_3.proto
@@ -0,0 +1,750 @@
+syntax = "proto2";
+
+package benchmarks.google_message4;
+
+option cc_enable_arenas = true;
+
+enum UnusedEnum {
+ UNUSED_ENUM_VALUE1 = 0;
+ UNUSED_ENUM_VALUE2 = 1;
+}
+
+enum Enum2593 {
+ ENUM_VALUE2594 = 0;
+ ENUM_VALUE2595 = 1;
+ ENUM_VALUE2596 = 2;
+ ENUM_VALUE2597 = 3;
+ ENUM_VALUE2598 = 4;
+ ENUM_VALUE2599 = 5;
+ ENUM_VALUE2600 = 6;
+ ENUM_VALUE2601 = 7;
+}
+
+enum Enum2834 {
+ ENUM_VALUE2835 = 0;
+ ENUM_VALUE2836 = 1;
+ ENUM_VALUE2837 = 2;
+}
+
+enum Enum2806 {
+ ENUM_VALUE2807 = 0;
+ ENUM_VALUE2808 = 1;
+ ENUM_VALUE2809 = 2;
+ ENUM_VALUE2810 = 3;
+ ENUM_VALUE2811 = 4;
+ ENUM_VALUE2812 = 5;
+ ENUM_VALUE2813 = 6;
+ ENUM_VALUE2814 = 7;
+ ENUM_VALUE2815 = 8;
+ ENUM_VALUE2816 = 9;
+ ENUM_VALUE2817 = 10;
+ ENUM_VALUE2818 = 11;
+ ENUM_VALUE2819 = 12;
+ ENUM_VALUE2820 = 13;
+ ENUM_VALUE2821 = 14;
+}
+
+enum Enum2851 {
+ option allow_alias = true;
+ ENUM_VALUE2852 = 0;
+ ENUM_VALUE2853 = 0;
+ ENUM_VALUE2854 = 1;
+ ENUM_VALUE2855 = 2;
+ ENUM_VALUE2856 = 3;
+ ENUM_VALUE2857 = 4;
+ ENUM_VALUE2858 = 5;
+ ENUM_VALUE2859 = 6;
+ ENUM_VALUE2860 = 7;
+ ENUM_VALUE2861 = 8;
+ ENUM_VALUE2862 = 9;
+ ENUM_VALUE2863 = 10;
+ ENUM_VALUE2864 = 11;
+ ENUM_VALUE2865 = 12;
+ ENUM_VALUE2866 = 13;
+ ENUM_VALUE2867 = 14;
+ ENUM_VALUE2868 = 15;
+ ENUM_VALUE2869 = 16;
+ ENUM_VALUE2870 = 17;
+ ENUM_VALUE2871 = 18;
+ ENUM_VALUE2872 = 19;
+ ENUM_VALUE2873 = 20;
+ ENUM_VALUE2874 = 21;
+ ENUM_VALUE2875 = 22;
+ ENUM_VALUE2876 = 23;
+ ENUM_VALUE2877 = 24;
+ ENUM_VALUE2878 = 25;
+ ENUM_VALUE2879 = 26;
+ ENUM_VALUE2880 = 27;
+ ENUM_VALUE2881 = 28;
+ ENUM_VALUE2882 = 29;
+ ENUM_VALUE2883 = 30;
+ ENUM_VALUE2884 = 31;
+ ENUM_VALUE2885 = 32;
+ ENUM_VALUE2886 = 33;
+ ENUM_VALUE2887 = 34;
+ ENUM_VALUE2888 = 35;
+ ENUM_VALUE2889 = 36;
+ ENUM_VALUE2890 = 37;
+ ENUM_VALUE2891 = 38;
+ ENUM_VALUE2892 = 39;
+ ENUM_VALUE2893 = 40;
+ ENUM_VALUE2894 = 41;
+ ENUM_VALUE2895 = 42;
+ ENUM_VALUE2896 = 43;
+ ENUM_VALUE2897 = 44;
+ ENUM_VALUE2898 = 45;
+ ENUM_VALUE2899 = 46;
+ ENUM_VALUE2900 = 47;
+ ENUM_VALUE2901 = 48;
+ ENUM_VALUE2902 = 49;
+ ENUM_VALUE2903 = 50;
+ ENUM_VALUE2904 = 51;
+ ENUM_VALUE2905 = 52;
+ ENUM_VALUE2906 = 53;
+ ENUM_VALUE2907 = 54;
+ ENUM_VALUE2908 = 55;
+ ENUM_VALUE2909 = 56;
+ ENUM_VALUE2910 = 57;
+ ENUM_VALUE2911 = 58;
+ ENUM_VALUE2912 = 59;
+ ENUM_VALUE2913 = 60;
+ ENUM_VALUE2914 = 61;
+ ENUM_VALUE2915 = 62;
+ ENUM_VALUE2916 = 63;
+ ENUM_VALUE2917 = 64;
+ ENUM_VALUE2918 = 65;
+ ENUM_VALUE2919 = 66;
+ ENUM_VALUE2920 = 67;
+ ENUM_VALUE2921 = 68;
+ ENUM_VALUE2922 = 69;
+ ENUM_VALUE2923 = 70;
+ ENUM_VALUE2924 = 71;
+ ENUM_VALUE2925 = 72;
+ ENUM_VALUE2926 = 73;
+ ENUM_VALUE2927 = 74;
+ ENUM_VALUE2928 = 75;
+ ENUM_VALUE2929 = 76;
+ ENUM_VALUE2930 = 77;
+ ENUM_VALUE2931 = 78;
+ ENUM_VALUE2932 = 79;
+ ENUM_VALUE2933 = 80;
+ ENUM_VALUE2934 = 81;
+ ENUM_VALUE2935 = 82;
+ ENUM_VALUE2936 = 83;
+ ENUM_VALUE2937 = 84;
+ ENUM_VALUE2938 = 85;
+ ENUM_VALUE2939 = 86;
+ ENUM_VALUE2940 = 87;
+ ENUM_VALUE2941 = 88;
+ ENUM_VALUE2942 = 89;
+ ENUM_VALUE2943 = 90;
+ ENUM_VALUE2944 = 91;
+ ENUM_VALUE2945 = 92;
+ ENUM_VALUE2946 = 93;
+ ENUM_VALUE2947 = 94;
+ ENUM_VALUE2948 = 95;
+ ENUM_VALUE2949 = 96;
+ ENUM_VALUE2950 = 97;
+ ENUM_VALUE2951 = 98;
+ ENUM_VALUE2952 = 99;
+ ENUM_VALUE2953 = 100;
+ ENUM_VALUE2954 = 101;
+ ENUM_VALUE2955 = 102;
+ ENUM_VALUE2956 = 103;
+ ENUM_VALUE2957 = 104;
+ ENUM_VALUE2958 = 105;
+ ENUM_VALUE2959 = 106;
+ ENUM_VALUE2960 = 107;
+ ENUM_VALUE2961 = 108;
+ ENUM_VALUE2962 = 109;
+ ENUM_VALUE2963 = 110;
+ ENUM_VALUE2964 = 111;
+ ENUM_VALUE2965 = 112;
+ ENUM_VALUE2966 = 113;
+ ENUM_VALUE2967 = 114;
+ ENUM_VALUE2968 = 115;
+ ENUM_VALUE2969 = 116;
+ ENUM_VALUE2970 = 117;
+ ENUM_VALUE2971 = 118;
+ ENUM_VALUE2972 = 119;
+}
+
+enum Enum2602 {
+ ENUM_VALUE2603 = 0;
+ ENUM_VALUE2604 = 1;
+ ENUM_VALUE2605 = 2;
+ ENUM_VALUE2606 = 3;
+ ENUM_VALUE2607 = 4;
+ ENUM_VALUE2608 = 5;
+ ENUM_VALUE2609 = 6;
+ ENUM_VALUE2610 = 7;
+ ENUM_VALUE2611 = 8;
+ ENUM_VALUE2612 = 9;
+ ENUM_VALUE2613 = 10;
+ ENUM_VALUE2614 = 11;
+}
+
+enum Enum3071 {
+ ENUM_VALUE3072 = 1;
+ ENUM_VALUE3073 = 2;
+ ENUM_VALUE3074 = 3;
+ ENUM_VALUE3075 = 4;
+ ENUM_VALUE3076 = 5;
+ ENUM_VALUE3077 = 6;
+ ENUM_VALUE3078 = 7;
+ ENUM_VALUE3079 = 8;
+ ENUM_VALUE3080 = 9;
+ ENUM_VALUE3081 = 10;
+ ENUM_VALUE3082 = 11;
+ ENUM_VALUE3083 = 12;
+ ENUM_VALUE3084 = 13;
+ ENUM_VALUE3085 = 14;
+ ENUM_VALUE3086 = 15;
+ ENUM_VALUE3087 = 16;
+ ENUM_VALUE3088 = 17;
+ ENUM_VALUE3089 = 18;
+ ENUM_VALUE3090 = 19;
+ ENUM_VALUE3091 = 20;
+ ENUM_VALUE3092 = 21;
+ ENUM_VALUE3093 = 22;
+ ENUM_VALUE3094 = 23;
+ ENUM_VALUE3095 = 24;
+ ENUM_VALUE3096 = 25;
+ ENUM_VALUE3097 = 26;
+ ENUM_VALUE3098 = 27;
+ ENUM_VALUE3099 = 28;
+}
+
+enum Enum3805 {
+ ENUM_VALUE3806 = 0;
+ ENUM_VALUE3807 = 1;
+ ENUM_VALUE3808 = 2;
+ ENUM_VALUE3809 = 3;
+ ENUM_VALUE3810 = 4;
+ ENUM_VALUE3811 = 5;
+ ENUM_VALUE3812 = 6;
+ ENUM_VALUE3813 = 7;
+ ENUM_VALUE3814 = 8;
+ ENUM_VALUE3815 = 9;
+ ENUM_VALUE3816 = 11;
+ ENUM_VALUE3817 = 10;
+}
+
+enum Enum3783 {
+ ENUM_VALUE3784 = 0;
+ ENUM_VALUE3785 = 1;
+ ENUM_VALUE3786 = 2;
+ ENUM_VALUE3787 = 3;
+ ENUM_VALUE3788 = 4;
+ ENUM_VALUE3789 = 5;
+ ENUM_VALUE3790 = 6;
+ ENUM_VALUE3791 = 7;
+ ENUM_VALUE3792 = 8;
+ ENUM_VALUE3793 = 9;
+ ENUM_VALUE3794 = 10;
+ ENUM_VALUE3795 = 11;
+ ENUM_VALUE3796 = 12;
+ ENUM_VALUE3797 = 13;
+ ENUM_VALUE3798 = 14;
+ ENUM_VALUE3799 = 15;
+ ENUM_VALUE3800 = 16;
+ ENUM_VALUE3801 = 20;
+ ENUM_VALUE3802 = 21;
+ ENUM_VALUE3803 = 50;
+}
+
+enum Enum3851 {
+ ENUM_VALUE3852 = 0;
+ ENUM_VALUE3853 = 1;
+ ENUM_VALUE3854 = 2;
+ ENUM_VALUE3855 = 3;
+ ENUM_VALUE3856 = 4;
+ ENUM_VALUE3857 = 5;
+ ENUM_VALUE3858 = 6;
+ ENUM_VALUE3859 = 7;
+ ENUM_VALUE3860 = 8;
+ ENUM_VALUE3861 = 9;
+ ENUM_VALUE3862 = 10;
+ ENUM_VALUE3863 = 11;
+ ENUM_VALUE3864 = 12;
+ ENUM_VALUE3865 = 13;
+ ENUM_VALUE3866 = 14;
+ ENUM_VALUE3867 = 15;
+ ENUM_VALUE3868 = 16;
+ ENUM_VALUE3869 = 17;
+}
+
+enum Enum5862 {
+ ENUM_VALUE5863 = 1;
+ ENUM_VALUE5864 = 2;
+ ENUM_VALUE5865 = 3;
+}
+
+enum Enum5868 {
+ ENUM_VALUE5869 = 0;
+ ENUM_VALUE5870 = 1;
+ ENUM_VALUE5871 = 2;
+ ENUM_VALUE5872 = 3;
+}
+
+enum Enum5873 {
+ ENUM_VALUE5874 = 0;
+ ENUM_VALUE5875 = 1;
+ ENUM_VALUE5876 = 2;
+}
+
+enum Enum5904 {
+ ENUM_VALUE5905 = 0;
+ ENUM_VALUE5906 = 1;
+}
+
+enum Enum5909 {
+ ENUM_VALUE5910 = 0;
+ ENUM_VALUE5911 = 1;
+}
+
+enum Enum5912 {
+ ENUM_VALUE5913 = 0;
+ ENUM_VALUE5914 = 1;
+}
+
+enum Enum5915 {
+ ENUM_VALUE5916 = 0;
+ ENUM_VALUE5917 = 1;
+ ENUM_VALUE5918 = 2;
+ ENUM_VALUE5919 = 3;
+}
+
+enum Enum5920 {
+ ENUM_VALUE5921 = 0;
+ ENUM_VALUE5922 = 1;
+}
+
+enum Enum5923 {
+ ENUM_VALUE5924 = 0;
+ ENUM_VALUE5925 = 1;
+ ENUM_VALUE5926 = 2;
+ ENUM_VALUE5927 = 3;
+}
+
+enum Enum5928 {
+ ENUM_VALUE5929 = 0;
+ ENUM_VALUE5930 = 1;
+}
+
+enum Enum5931 {
+ ENUM_VALUE5932 = 0;
+ ENUM_VALUE5933 = 1;
+ ENUM_VALUE5934 = 2;
+}
+
+enum Enum5935 {
+ ENUM_VALUE5936 = 0;
+ ENUM_VALUE5937 = 1;
+ ENUM_VALUE5938 = 2;
+}
+
+enum Enum5939 {
+ ENUM_VALUE5940 = 0;
+ ENUM_VALUE5941 = 1;
+ ENUM_VALUE5942 = 2;
+ ENUM_VALUE5943 = 3;
+ ENUM_VALUE5944 = 4;
+ ENUM_VALUE5945 = 5;
+}
+
+enum Enum5946 {
+ ENUM_VALUE5947 = 0;
+ ENUM_VALUE5948 = 1;
+ ENUM_VALUE5949 = 2;
+ ENUM_VALUE5950 = 3;
+ ENUM_VALUE5951 = 4;
+ ENUM_VALUE5952 = 5;
+ ENUM_VALUE5953 = 6;
+ ENUM_VALUE5954 = 7;
+ ENUM_VALUE5955 = 8;
+ ENUM_VALUE5956 = 9;
+}
+
+enum Enum5957 {
+ ENUM_VALUE5958 = 0;
+ ENUM_VALUE5959 = 1;
+ ENUM_VALUE5960 = 2;
+ ENUM_VALUE5961 = 3;
+}
+
+enum Enum5962 {
+ ENUM_VALUE5963 = 0;
+ ENUM_VALUE5964 = 1;
+}
+
+enum Enum6025 {
+ ENUM_VALUE6026 = 0;
+ ENUM_VALUE6027 = 1;
+ ENUM_VALUE6028 = 2;
+ ENUM_VALUE6029 = 3;
+ ENUM_VALUE6030 = 4;
+ ENUM_VALUE6031 = 5;
+ ENUM_VALUE6032 = 6;
+ ENUM_VALUE6033 = 7;
+ ENUM_VALUE6034 = 8;
+ ENUM_VALUE6035 = 9;
+ ENUM_VALUE6036 = 10;
+ ENUM_VALUE6037 = 11;
+ ENUM_VALUE6038 = 12;
+ ENUM_VALUE6039 = 13;
+ ENUM_VALUE6040 = 14;
+ ENUM_VALUE6041 = 15;
+ ENUM_VALUE6042 = 16;
+ ENUM_VALUE6043 = 17;
+ ENUM_VALUE6044 = 18;
+ ENUM_VALUE6045 = 19;
+ ENUM_VALUE6046 = 20;
+ ENUM_VALUE6047 = 21;
+}
+
+enum Enum6111 {
+ ENUM_VALUE6112 = 1;
+ ENUM_VALUE6113 = 2;
+ ENUM_VALUE6114 = 3;
+ ENUM_VALUE6115 = 4;
+ ENUM_VALUE6116 = 5;
+ ENUM_VALUE6117 = 6;
+ ENUM_VALUE6118 = 7;
+ ENUM_VALUE6119 = 8;
+ ENUM_VALUE6120 = 9;
+ ENUM_VALUE6121 = 10;
+ ENUM_VALUE6122 = 11;
+ ENUM_VALUE6123 = 12;
+ ENUM_VALUE6124 = 13;
+ ENUM_VALUE6125 = 14;
+}
+
+enum Enum6065 {
+ ENUM_VALUE6066 = 0;
+ ENUM_VALUE6067 = 1;
+ ENUM_VALUE6068 = 2;
+ ENUM_VALUE6069 = 3;
+ ENUM_VALUE6070 = 4;
+ ENUM_VALUE6071 = 5;
+ ENUM_VALUE6072 = 6;
+ ENUM_VALUE6073 = 7;
+ ENUM_VALUE6074 = 8;
+ ENUM_VALUE6075 = 9;
+ ENUM_VALUE6076 = 10;
+ ENUM_VALUE6077 = 11;
+ ENUM_VALUE6078 = 12;
+ ENUM_VALUE6079 = 13;
+ ENUM_VALUE6080 = 14;
+}
+
+enum Enum6130 {
+ ENUM_VALUE6131 = 0;
+ ENUM_VALUE6132 = 1;
+}
+
+enum Enum6579 {
+ ENUM_VALUE6580 = 0;
+ ENUM_VALUE6581 = 2;
+ ENUM_VALUE6582 = 3;
+ ENUM_VALUE6583 = 5;
+ ENUM_VALUE6584 = 10;
+ ENUM_VALUE6585 = 15;
+ ENUM_VALUE6586 = 25;
+ ENUM_VALUE6587 = 30;
+}
+
+enum Enum6588 {
+ ENUM_VALUE6589 = 0;
+ ENUM_VALUE6590 = 1;
+ ENUM_VALUE6591 = 2;
+ ENUM_VALUE6592 = 3;
+ ENUM_VALUE6593 = 4;
+ ENUM_VALUE6594 = 5;
+ ENUM_VALUE6595 = 6;
+ ENUM_VALUE6596 = 7;
+ ENUM_VALUE6597 = 8;
+ ENUM_VALUE6598 = 9;
+ ENUM_VALUE6599 = 10;
+ ENUM_VALUE6600 = 11;
+ ENUM_VALUE6601 = 12;
+ ENUM_VALUE6602 = 13;
+ ENUM_VALUE6603 = 14;
+ ENUM_VALUE6604 = 15;
+ ENUM_VALUE6605 = 16;
+ ENUM_VALUE6606 = 17;
+ ENUM_VALUE6607 = 19;
+ ENUM_VALUE6608 = 20;
+ ENUM_VALUE6609 = 21;
+ ENUM_VALUE6610 = 22;
+ ENUM_VALUE6611 = 23;
+ ENUM_VALUE6612 = 24;
+ ENUM_VALUE6613 = 25;
+ ENUM_VALUE6614 = 26;
+ ENUM_VALUE6615 = 27;
+ ENUM_VALUE6616 = 28;
+ ENUM_VALUE6617 = 29;
+ ENUM_VALUE6618 = 30;
+ ENUM_VALUE6619 = 31;
+ ENUM_VALUE6620 = 32;
+ ENUM_VALUE6621 = 33;
+ ENUM_VALUE6622 = 34;
+}
+
+enum Enum7288 {
+ ENUM_VALUE7289 = 0;
+ ENUM_VALUE7290 = 1;
+ ENUM_VALUE7291 = 2;
+ ENUM_VALUE7292 = 3;
+}
+
+enum Enum7512 {
+ ENUM_VALUE7513 = 0;
+ ENUM_VALUE7514 = 1;
+ ENUM_VALUE7515 = 2;
+ ENUM_VALUE7516 = 3;
+ ENUM_VALUE7517 = 4;
+ ENUM_VALUE7518 = 5;
+ ENUM_VALUE7519 = 6;
+ ENUM_VALUE7520 = 7;
+}
+
+enum Enum7922 {
+ ENUM_VALUE7923 = 1;
+ ENUM_VALUE7924 = 2;
+ ENUM_VALUE7925 = 3;
+ ENUM_VALUE7926 = 4;
+ ENUM_VALUE7927 = 5;
+}
+
+enum Enum3476 {
+ ENUM_VALUE3477 = 0;
+ ENUM_VALUE3478 = 1;
+ ENUM_VALUE3479 = 2;
+ ENUM_VALUE3480 = 3;
+ ENUM_VALUE3481 = 4;
+ ENUM_VALUE3482 = 5;
+ ENUM_VALUE3483 = 6;
+ ENUM_VALUE3484 = 7;
+ ENUM_VALUE3485 = 8;
+ ENUM_VALUE3486 = 9;
+ ENUM_VALUE3487 = 10;
+ ENUM_VALUE3488 = 11;
+ ENUM_VALUE3489 = 12;
+ ENUM_VALUE3490 = 13;
+ ENUM_VALUE3491 = 14;
+ ENUM_VALUE3492 = 15;
+ ENUM_VALUE3493 = 16;
+ ENUM_VALUE3494 = 17;
+ ENUM_VALUE3495 = 18;
+ ENUM_VALUE3496 = 19;
+ ENUM_VALUE3497 = 20;
+ ENUM_VALUE3498 = 21;
+ ENUM_VALUE3499 = 22;
+ ENUM_VALUE3500 = 23;
+ ENUM_VALUE3501 = 24;
+ ENUM_VALUE3502 = 25;
+ ENUM_VALUE3503 = 26;
+ ENUM_VALUE3504 = 27;
+ ENUM_VALUE3505 = 28;
+ ENUM_VALUE3506 = 29;
+ ENUM_VALUE3507 = 30;
+ ENUM_VALUE3508 = 31;
+ ENUM_VALUE3509 = 32;
+ ENUM_VALUE3510 = 33;
+ ENUM_VALUE3511 = 34;
+ ENUM_VALUE3512 = 35;
+ ENUM_VALUE3513 = 36;
+ ENUM_VALUE3514 = 37;
+ ENUM_VALUE3515 = 38;
+ ENUM_VALUE3516 = 39;
+ ENUM_VALUE3517 = 40;
+ ENUM_VALUE3518 = 41;
+ ENUM_VALUE3519 = 42;
+ ENUM_VALUE3520 = 43;
+ ENUM_VALUE3521 = 44;
+ ENUM_VALUE3522 = 45;
+ ENUM_VALUE3523 = 46;
+ ENUM_VALUE3524 = 47;
+ ENUM_VALUE3525 = 48;
+ ENUM_VALUE3526 = 49;
+ ENUM_VALUE3527 = 50;
+ ENUM_VALUE3528 = 51;
+ ENUM_VALUE3529 = 52;
+ ENUM_VALUE3530 = 53;
+ ENUM_VALUE3531 = 54;
+ ENUM_VALUE3532 = 55;
+ ENUM_VALUE3533 = 56;
+ ENUM_VALUE3534 = 57;
+ ENUM_VALUE3535 = 58;
+ ENUM_VALUE3536 = 59;
+ ENUM_VALUE3537 = 60;
+ ENUM_VALUE3538 = 61;
+ ENUM_VALUE3539 = 62;
+ ENUM_VALUE3540 = 63;
+ ENUM_VALUE3541 = 64;
+ ENUM_VALUE3542 = 65;
+ ENUM_VALUE3543 = 66;
+ ENUM_VALUE3544 = 67;
+ ENUM_VALUE3545 = 68;
+ ENUM_VALUE3546 = 69;
+ ENUM_VALUE3547 = 70;
+ ENUM_VALUE3548 = 71;
+ ENUM_VALUE3549 = 72;
+ ENUM_VALUE3550 = 73;
+ ENUM_VALUE3551 = 74;
+ ENUM_VALUE3552 = 75;
+ ENUM_VALUE3553 = 76;
+ ENUM_VALUE3554 = 77;
+ ENUM_VALUE3555 = 78;
+ ENUM_VALUE3556 = 79;
+ ENUM_VALUE3557 = 80;
+ ENUM_VALUE3558 = 81;
+ ENUM_VALUE3559 = 82;
+ ENUM_VALUE3560 = 83;
+ ENUM_VALUE3561 = 84;
+ ENUM_VALUE3562 = 85;
+ ENUM_VALUE3563 = 86;
+ ENUM_VALUE3564 = 87;
+ ENUM_VALUE3565 = 88;
+ ENUM_VALUE3566 = 89;
+ ENUM_VALUE3567 = 90;
+ ENUM_VALUE3568 = 91;
+ ENUM_VALUE3569 = 92;
+ ENUM_VALUE3570 = 93;
+ ENUM_VALUE3571 = 94;
+ ENUM_VALUE3572 = 95;
+ ENUM_VALUE3573 = 96;
+ ENUM_VALUE3574 = 97;
+ ENUM_VALUE3575 = 98;
+ ENUM_VALUE3576 = 99;
+ ENUM_VALUE3577 = 100;
+ ENUM_VALUE3578 = 101;
+ ENUM_VALUE3579 = 102;
+ ENUM_VALUE3580 = 103;
+ ENUM_VALUE3581 = 104;
+ ENUM_VALUE3582 = 105;
+ ENUM_VALUE3583 = 106;
+ ENUM_VALUE3584 = 107;
+ ENUM_VALUE3585 = 108;
+ ENUM_VALUE3586 = 109;
+ ENUM_VALUE3587 = 110;
+ ENUM_VALUE3588 = 111;
+ ENUM_VALUE3589 = 112;
+ ENUM_VALUE3590 = 113;
+ ENUM_VALUE3591 = 114;
+ ENUM_VALUE3592 = 115;
+ ENUM_VALUE3593 = 116;
+ ENUM_VALUE3594 = 117;
+ ENUM_VALUE3595 = 118;
+ ENUM_VALUE3596 = 119;
+ ENUM_VALUE3597 = 120;
+ ENUM_VALUE3598 = 121;
+ ENUM_VALUE3599 = 122;
+ ENUM_VALUE3600 = 123;
+ ENUM_VALUE3601 = 124;
+ ENUM_VALUE3602 = 125;
+ ENUM_VALUE3603 = 126;
+ ENUM_VALUE3604 = 127;
+ ENUM_VALUE3605 = 128;
+ ENUM_VALUE3606 = 129;
+ ENUM_VALUE3607 = 130;
+ ENUM_VALUE3608 = 131;
+ ENUM_VALUE3609 = 132;
+ ENUM_VALUE3610 = 133;
+ ENUM_VALUE3611 = 134;
+ ENUM_VALUE3612 = 135;
+ ENUM_VALUE3613 = 136;
+ ENUM_VALUE3614 = 137;
+ ENUM_VALUE3615 = 138;
+ ENUM_VALUE3616 = 139;
+ ENUM_VALUE3617 = 140;
+ ENUM_VALUE3618 = 141;
+ ENUM_VALUE3619 = 142;
+ ENUM_VALUE3620 = 143;
+ ENUM_VALUE3621 = 144;
+ ENUM_VALUE3622 = 145;
+ ENUM_VALUE3623 = 146;
+ ENUM_VALUE3624 = 147;
+ ENUM_VALUE3625 = 148;
+ ENUM_VALUE3626 = 149;
+ ENUM_VALUE3627 = 150;
+ ENUM_VALUE3628 = 151;
+ ENUM_VALUE3629 = 152;
+ ENUM_VALUE3630 = 153;
+ ENUM_VALUE3631 = 154;
+ ENUM_VALUE3632 = 155;
+ ENUM_VALUE3633 = 156;
+ ENUM_VALUE3634 = 157;
+ ENUM_VALUE3635 = 158;
+ ENUM_VALUE3636 = 159;
+ ENUM_VALUE3637 = 160;
+ ENUM_VALUE3638 = 161;
+ ENUM_VALUE3639 = 162;
+ ENUM_VALUE3640 = 163;
+ ENUM_VALUE3641 = 164;
+ ENUM_VALUE3642 = 165;
+ ENUM_VALUE3643 = 166;
+ ENUM_VALUE3644 = 167;
+ ENUM_VALUE3645 = 168;
+ ENUM_VALUE3646 = 169;
+ ENUM_VALUE3647 = 170;
+ ENUM_VALUE3648 = 171;
+ ENUM_VALUE3649 = 172;
+ ENUM_VALUE3650 = 173;
+ ENUM_VALUE3651 = 174;
+ ENUM_VALUE3652 = 175;
+ ENUM_VALUE3653 = 176;
+ ENUM_VALUE3654 = 177;
+ ENUM_VALUE3655 = 178;
+ ENUM_VALUE3656 = 179;
+ ENUM_VALUE3657 = 180;
+ ENUM_VALUE3658 = 181;
+ ENUM_VALUE3659 = 182;
+ ENUM_VALUE3660 = 183;
+}
+
+enum Enum10325 {
+ ENUM_VALUE10326 = 0;
+ ENUM_VALUE10327 = 1;
+ ENUM_VALUE10328 = 2;
+ ENUM_VALUE10329 = 3;
+ ENUM_VALUE10330 = 4;
+ ENUM_VALUE10331 = 5;
+ ENUM_VALUE10332 = 6;
+ ENUM_VALUE10333 = 7;
+ ENUM_VALUE10334 = 8;
+}
+
+enum Enum10335 {
+ ENUM_VALUE10336 = 0;
+}
+
+enum Enum10337 {
+ ENUM_VALUE10338 = 0;
+ ENUM_VALUE10339 = 1;
+}
+
+enum Enum11901 {
+ ENUM_VALUE11902 = 0;
+ ENUM_VALUE11903 = 1;
+ ENUM_VALUE11904 = 2;
+ ENUM_VALUE11905 = 3;
+}
+
+enum Enum12735 {
+ ENUM_VALUE12736 = 0;
+ ENUM_VALUE12737 = 1;
+ ENUM_VALUE12738 = 2;
+ ENUM_VALUE12739 = 3;
+}
+
+enum Enum12871 {
+ ENUM_VALUE12872 = 1;
+ ENUM_VALUE12873 = 2;
+ ENUM_VALUE12874 = 3;
+ ENUM_VALUE12875 = 4;
+ ENUM_VALUE12876 = 5;
+ ENUM_VALUE12877 = 6;
+}
+
diff --git a/benchmarks/download_data.sh b/benchmarks/download_data.sh
new file mode 100755
index 00000000..fa0729e9
--- /dev/null
+++ b/benchmarks/download_data.sh
@@ -0,0 +1,5 @@
+#! /bin/sh
+
+curl -O https://storage.googleapis.com/protobuf_opensource_benchmark_data/datasets.tar.gz
+tar -zvxf datasets.tar.gz
+
diff --git a/benchmarks/generate_datasets.cc b/benchmarks/generate_datasets.cc
deleted file mode 100644
index 61e7adf1..00000000
--- a/benchmarks/generate_datasets.cc
+++ /dev/null
@@ -1,117 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include <fstream>
-#include <iostream>
-#include "benchmarks.pb.h"
-
-using benchmarks::BenchmarkDataset;
-using google::protobuf::Descriptor;
-using google::protobuf::DescriptorPool;
-using google::protobuf::Message;
-using google::protobuf::MessageFactory;
-
-std::set<std::string> names;
-
-const char *file_prefix = "dataset.";
-const char *file_suffix = ".pb";
-
-void WriteFileWithPayloads(const std::string& name,
- const std::string& message_name,
- const std::vector<std::string>& payload) {
- if (!names.insert(name).second) {
- std::cerr << "Duplicate test name: " << name << "\n";
- abort();
- }
-
- // First verify that this message name exists in our set of benchmark messages
- // and that these payloads are valid for the given message.
- const Descriptor* d =
- DescriptorPool::generated_pool()->FindMessageTypeByName(message_name);
-
- if (!d) {
- std::cerr << "For dataset " << name << ", no such message: "
- << message_name << "\n";
- abort();
- }
-
- Message* m = MessageFactory::generated_factory()->GetPrototype(d)->New();
-
- for (size_t i = 0; i < payload.size(); i++) {
- if (!m->ParseFromString(payload[i])) {
- std::cerr << "For dataset " << name << ", payload[" << i << "] fails "
- << "to parse\n";
- abort();
- }
- }
-
- BenchmarkDataset dataset;
- dataset.set_name(name);
- dataset.set_message_name(message_name);
- for (size_t i = 0; i < payload.size(); i++) {
- dataset.add_payload()->assign(payload[i]);
- }
-
- std::ofstream writer;
- std::string fname = file_prefix + name + file_suffix;
- writer.open(fname.c_str());
- dataset.SerializeToOstream(&writer);
- writer.close();
-
- std::cerr << "Wrote dataset: " << fname << "\n";
-}
-
-void WriteFile(const std::string& name, const std::string& message_name,
- const std::string& payload) {
- std::vector<std::string> payloads;
- payloads.push_back(payload);
- WriteFileWithPayloads(name, message_name, payloads);
-}
-
-std::string ReadFile(const std::string& name) {
- std::ifstream file(name.c_str());
- GOOGLE_CHECK(file.is_open()) << "Couldn't find file '" << name <<
- "', please make sure you are running "
- "this command from the benchmarks/ "
- "directory.\n";
- return std::string((std::istreambuf_iterator<char>(file)),
- std::istreambuf_iterator<char>());
-}
-
-int main() {
- WriteFile("google_message1_proto3", "benchmarks.proto3.GoogleMessage1",
- ReadFile("google_message1.dat"));
- WriteFile("google_message1_proto2", "benchmarks.proto2.GoogleMessage1",
- ReadFile("google_message1.dat"));
-
- // Not in proto3 because it has a group, which is not supported.
- WriteFile("google_message2", "benchmarks.proto2.GoogleMessage2",
- ReadFile("google_message2.dat"));
-}
diff --git a/benchmarks/readme.txt b/benchmarks/readme.txt
deleted file mode 100644
index b08b8bc0..00000000
--- a/benchmarks/readme.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-Contents
---------
-
-This folder contains three kinds of file:
-
-- Code, such as ProtoBench.java, to build the benchmarking framework.
-- Protocol buffer definitions (.proto files)
-- Sample data files
-
-If we end up with a lot of different benchmarks it may be worth
-separating these out info different directories, but while there are
-so few they might as well all be together.
-
-Running a benchmark (Java)
---------------------------
-
-1) Build protoc and the Java protocol buffer library. The examples
- below assume a jar file (protobuf.jar) has been built and copied
- into this directory.
-
-2) Build ProtoBench:
- $ javac -d tmp -cp protobuf.jar ProtoBench.java
-
-3) Generate code for the relevant benchmark protocol buffer, e.g.
- $ protoc --java_out=tmp google_size.proto
-
-4) Build the generated code, e.g.
- $ javac -d tmp -cp protobuf.jar tmp/benchmarks/*.java
-
-5) Run the test. Arguments are given in pairs - the first argument
- is the descriptor type; the second is the filename. For example:
- $ java -cp tmp:protobuf.jar com.google.protocolbuffers.ProtoBench \
- 'benchmarks.GoogleSize$SizeMessage1' google_message1.dat \
- 'benchmarks.GoogleSize$SizeMessage2' google_message2.dat
-
-6) Wait! Each test runs for around 30 seconds, and there are 8 tests
- per class/data combination. The above command would therefore take
- about 8 minutes to run.
-
-
-Benchmarks available
---------------------
-
-From Google:
-google_size.proto,
-messages google_message1.dat and google_message2.dat.
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index f159f60e..2351392d 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -14,6 +14,7 @@ project(protobuf C CXX)
# Options
option(protobuf_BUILD_TESTS "Build tests" ON)
option(protobuf_BUILD_EXAMPLES "Build examples" OFF)
+option(protobuf_BUILD_PROTOC_BINARIES "Build libprotoc and protoc compiler" ON)
if (BUILD_SHARED_LIBS)
set(protobuf_BUILD_SHARED_LIBS_DEFAULT ON)
else (BUILD_SHARED_LIBS)
@@ -184,8 +185,10 @@ endif (protobuf_UNICODE)
include(libprotobuf-lite.cmake)
include(libprotobuf.cmake)
-include(libprotoc.cmake)
-include(protoc.cmake)
+if (protobuf_BUILD_PROTOC_BINARIES)
+ include(libprotoc.cmake)
+ include(protoc.cmake)
+endif (protobuf_BUILD_PROTOC_BINARIES)
if (protobuf_BUILD_TESTS)
include(tests.cmake)
diff --git a/cmake/extract_includes.bat.in b/cmake/extract_includes.bat.in
index 5212d00a..5178f5b2 100644
--- a/cmake/extract_includes.bat.in
+++ b/cmake/extract_includes.bat.in
@@ -53,6 +53,7 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_ref
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_table_driven.h" include\google\protobuf\generated_message_table_driven.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_util.h" include\google\protobuf\generated_message_util.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\has_bits.h" include\google\protobuf\has_bits.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\implicit_weak_message.h" include\google\protobuf\implicit_weak_message.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\coded_stream.h" include\google\protobuf\io\coded_stream.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\gzip_stream.h" include\google\protobuf\io\gzip_stream.h
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\printer.h" include\google\protobuf\io\printer.h
diff --git a/cmake/install.cmake b/cmake/install.cmake
index 441bf553..82036cb6 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -5,10 +5,12 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf.pc.cmake
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protobuf-lite.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc @ONLY)
-foreach(_library
- libprotobuf-lite
- libprotobuf
- libprotoc)
+set(_protobuf_libraries libprotobuf-lite libprotobuf)
+if (protobuf_BUILD_PROTOC_BINARIES)
+ list(APPEND _protobuf_libraries libprotoc)
+endif (protobuf_BUILD_PROTOC_BINARIES)
+
+foreach(_library ${_protobuf_libraries})
set_property(TARGET ${_library}
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${protobuf_source_dir}/src>
@@ -19,8 +21,10 @@ foreach(_library
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
endforeach()
-install(TARGETS protoc EXPORT protobuf-targets
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
+if (protobuf_BUILD_PROTOC_BINARIES)
+ install(TARGETS protoc EXPORT protobuf-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
+endif (protobuf_BUILD_PROTOC_BINARIES)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
@@ -101,10 +105,18 @@ configure_file(protobuf-options.cmake
${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY)
# Allows the build directory to be used as a find directory.
-export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc
- NAMESPACE protobuf::
- FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
-)
+
+if (protobuf_BUILD_PROTOC_BINARIES)
+ export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc
+ NAMESPACE protobuf::
+ FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
+ )
+else (protobuf_BUILD_PROTOC_BINARIES)
+ export(TARGETS libprotobuf-lite libprotobuf
+ NAMESPACE protobuf::
+ FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
+ )
+endif (protobuf_BUILD_PROTOC_BINARIES)
install(EXPORT protobuf-targets
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
diff --git a/cmake/libprotobuf-lite.cmake b/cmake/libprotobuf-lite.cmake
index 9e1fab0a..f5242d4f 100644
--- a/cmake/libprotobuf-lite.cmake
+++ b/cmake/libprotobuf-lite.cmake
@@ -4,6 +4,7 @@ set(libprotobuf_lite_files
${protobuf_source_dir}/src/google/protobuf/extension_set.cc
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_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/io/coded_stream.cc
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.cc
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
@@ -31,6 +32,7 @@ set(libprotobuf_lite_includes
${protobuf_source_dir}/src/google/protobuf/arenastring.h
${protobuf_source_dir}/src/google/protobuf/extension_set.h
${protobuf_source_dir}/src/google/protobuf/generated_message_util.h
+ ${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.h
${protobuf_source_dir}/src/google/protobuf/io/coded_stream.h
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.h
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.h
diff --git a/configure.ac b/configure.ac
index 7ff20b13..b00bfdb5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,6 +52,16 @@ AC_ARG_WITH([zlib],
[include classes for streaming compressed data in and out @<:@default=check@:>@])],
[],[with_zlib=check])
+AC_ARG_WITH([zlib-include],
+ [AS_HELP_STRING([--with-zlib-include=PATH],
+ [zlib include directory])],
+ [CPPFLAGS="-I$withval $CPPFLAGS"])
+
+AC_ARG_WITH([zlib-lib],
+ [AS_HELP_STRING([--with-zlib-lib=PATH],
+ [zlib lib directory])],
+ [LDFLAGS="-L$withval $LDFLAGS"])
+
AC_ARG_WITH([protoc],
[AS_HELP_STRING([--with-protoc=COMMAND],
[use the given protoc command instead of building a new one when building tests (useful for cross-compiling)])],
diff --git a/conformance/failure_list_cpp.txt b/conformance/failure_list_cpp.txt
index 8c328890..752fbb5d 100644
--- a/conformance/failure_list_cpp.txt
+++ b/conformance/failure_list_cpp.txt
@@ -54,4 +54,3 @@ Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32
Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64
Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32
Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64
-
diff --git a/conformance/failure_list_java.txt b/conformance/failure_list_java.txt
index 5116c569..dc1f9ba5 100644
--- a/conformance/failure_list_java.txt
+++ b/conformance/failure_list_java.txt
@@ -44,4 +44,4 @@ Required.Proto3.JsonInput.StringFieldNotAString
Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
-Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE \ No newline at end of file
+Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
index 5836dfff..378b61d4 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs
@@ -158,17 +158,18 @@ namespace Google.Protobuf.WellKnownTypes {
public const int TypeUrlFieldNumber = 1;
private string typeUrl_ = "";
/// <summary>
- /// A URL/resource name whose content describes the type of the
- /// serialized protocol buffer message.
+ /// A URL/resource name that uniquely identifies the type of the serialized
+ /// protocol buffer message. The last segment of the URL's path must represent
+ /// the fully qualified name of the type (as in
+ /// `path/google.protobuf.Duration`). The name should be in a canonical form
+ /// (e.g., leading "." is not accepted).
///
- /// For URLs which use the scheme `http`, `https`, or no scheme, the
- /// following restrictions and interpretations apply:
+ /// In practice, teams usually precompile into the binary all types that they
+ /// expect it to use in the context of Any. However, for URLs which use the
+ /// scheme `http`, `https`, or no scheme, one can optionally set up a type
+ /// server that maps type URLs to message definitions as follows:
///
/// * If no scheme is provided, `https` is assumed.
- /// * The last segment of the URL's path must represent the fully
- /// qualified name of the type (as in `path/google.protobuf.Duration`).
- /// The name should be in a canonical form (e.g., leading "." is
- /// not accepted).
/// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
/// value in binary format, or produce an error.
/// * Applications are allowed to cache lookup results based on the
@@ -177,6 +178,10 @@ namespace Google.Protobuf.WellKnownTypes {
/// on changes to types. (Use versioned type names to manage
/// 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.
+ ///
/// Schemes other than `http`, `https` (or the empty scheme) might be
/// used with implementation specific semantics.
/// </summary>
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
index bf2943df..ef752be7 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs
@@ -103,7 +103,9 @@ namespace Google.Protobuf.WellKnownTypes {
/// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
/// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
/// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
- /// is required, though only UTC (as indicated by "Z") is presently supported.
+ /// is required. A proto3 JSON serializer should always use UTC (as indicated by
+ /// "Z") when printing the Timestamp type and a proto3 JSON parser should be
+ /// able to accept both UTC and other timezones (as indicated by an offset).
///
/// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
/// 01:30 UTC on January 15, 2017.
@@ -114,8 +116,8 @@ namespace Google.Protobuf.WellKnownTypes {
/// to this format using [`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--)
- /// to obtain a formatter capable of generating timestamps in this format.
+ /// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
+ /// ) to obtain a formatter capable of generating timestamps in this format.
/// </summary>
public sealed partial class Timestamp : pb::IMessage<Timestamp> {
private static readonly pb::MessageParser<Timestamp> _parser = new pb::MessageParser<Timestamp>(() => new Timestamp());
diff --git a/docs/third_party.md b/docs/third_party.md
index b20d4cb1..1a22e7f9 100644
--- a/docs/third_party.md
+++ b/docs/third_party.md
@@ -162,3 +162,4 @@ There are miscellaneous other things you may find useful as a Protocol Buffers d
* [Protocol Buffers Dynamic Schema - create protobuf schemas programmatically (Java)] (https://github.com/os72/protobuf-dynamic)
* [Make protoc plugins in NodeJS](https://github.com/konsumer/node-protoc-plugin)
* [ProfaneDB - A Protocol Buffers database](https://profanedb.gitlab.io)
+* [Protocol Buffer property-based testing utility and example message generator (Python / Hypothesis)](https://github.com/CurataEng/hypothesis-protobuf)
diff --git a/examples/WORKSPACE b/examples/WORKSPACE
index bb003107..936f2441 100644
--- a/examples/WORKSPACE
+++ b/examples/WORKSPACE
@@ -5,6 +5,8 @@ http_archive(
strip_prefix = "protobuf-master",
urls = ["https://github.com/google/protobuf/archive/master.zip"],
)
+load("@com_google_protobuf//:protobuf.bzl", "check_protobuf_required_bazel_version")
+check_protobuf_required_bazel_version()
# This com_google_protobuf_cc repository is required for cc_proto_library
# rule. It provides protobuf C++ runtime. Note that it actually is the same
diff --git a/src/google/protobuf/unittest_import_public_proto3.proto b/java/core/src/main/java/com/google/protobuf/Android.java
index d6f11e28..cad54783 100644
--- a/src/google/protobuf/unittest_import_public_proto3.proto
+++ b/java/core/src/main/java/com/google/protobuf/Android.java
@@ -28,15 +28,30 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Author: liujisi@google.com (Pherl Liu)
+package com.google.protobuf;
-syntax = "proto3";
+final class Android {
-package protobuf_unittest_import;
+ private static final Class<?> MEMORY_CLASS = getClassForName("libcore.io.Memory");
+ private static final boolean IS_ROBOLECTRIC =
+ getClassForName("org.robolectric.Robolectric") != null;
-option java_package = "com.google.protobuf.test";
-option csharp_namespace = "Google.Protobuf.TestProtos";
+ /** Returns {@code true} if running on an Android device. */
+ static boolean isOnAndroidDevice() {
+ return MEMORY_CLASS != null && !IS_ROBOLECTRIC;
+ }
-message PublicImportMessage {
- int32 e = 1;
+ /** Returns the memory class or {@code null} if not on Android device. */
+ static Class<?> getMemoryClass() {
+ return MEMORY_CLASS;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T> Class<T> getClassForName(String name) {
+ try {
+ return (Class<T>) Class.forName(name);
+ } catch (Throwable e) {
+ return null;
+ }
+ }
}
diff --git a/java/core/src/main/java/com/google/protobuf/ByteString.java b/java/core/src/main/java/com/google/protobuf/ByteString.java
index 99a31209..d67bb54a 100644
--- a/java/core/src/main/java/com/google/protobuf/ByteString.java
+++ b/java/core/src/main/java/com/google/protobuf/ByteString.java
@@ -124,14 +124,8 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
private static final ByteArrayCopier byteArrayCopier;
static {
- boolean isAndroid = true;
- try {
- Class.forName("android.content.Context");
- } catch (ClassNotFoundException e) {
- isAndroid = false;
- }
-
- byteArrayCopier = isAndroid ? new SystemByteArrayCopier() : new ArraysByteArrayCopier();
+ byteArrayCopier =
+ Android.isOnAndroidDevice() ? new SystemByteArrayCopier() : new ArraysByteArrayCopier();
}
/**
diff --git a/java/core/src/main/java/com/google/protobuf/CodedInputStream.java b/java/core/src/main/java/com/google/protobuf/CodedInputStream.java
index e08a993b..7a3f0eb9 100644
--- a/java/core/src/main/java/com/google/protobuf/CodedInputStream.java
+++ b/java/core/src/main/java/com/google/protobuf/CodedInputStream.java
@@ -64,6 +64,14 @@ public abstract class CodedInputStream {
// Integer.MAX_VALUE == 0x7FFFFFF == INT_MAX from limits.h
private static final int DEFAULT_SIZE_LIMIT = Integer.MAX_VALUE;
+ /**
+ * Whether to enable our custom UTF-8 decode codepath which does not use {@link StringCoding}.
+ * Enabled by default, disable by setting
+ * {@code -Dcom.google.protobuf.enableCustomutf8Decode=false} in JVM args.
+ */
+ private static final boolean ENABLE_CUSTOM_UTF8_DECODE
+ = !"false".equals(System.getProperty("com.google.protobuf.enableCustomUtf8Decode"));
+
/** Visible for subclasses. See setRecursionLimit() */
int recursionDepth;
@@ -825,13 +833,19 @@ public abstract class CodedInputStream {
public String readStringRequireUtf8() throws IOException {
final int size = readRawVarint32();
if (size > 0 && size <= (limit - pos)) {
- // TODO(martinrb): We could save a pass by validating while decoding.
- if (!Utf8.isValidUtf8(buffer, pos, pos + size)) {
- throw InvalidProtocolBufferException.invalidUtf8();
+ if (ENABLE_CUSTOM_UTF8_DECODE) {
+ String result = Utf8.decodeUtf8(buffer, pos, size);
+ pos += size;
+ return result;
+ } else {
+ // TODO(martinrb): We could save a pass by validating while decoding.
+ if (!Utf8.isValidUtf8(buffer, pos, pos + size)) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ final int tempPos = pos;
+ pos += size;
+ return new String(buffer, tempPos, size, UTF_8);
}
- final int tempPos = pos;
- pos += size;
- return new String(buffer, tempPos, size, UTF_8);
}
if (size == 0) {
@@ -1524,6 +1538,8 @@ public abstract class CodedInputStream {
final int size = readRawVarint32();
if (size > 0 && size <= remaining()) {
// TODO(nathanmittler): Is there a way to avoid this copy?
+ // TODO(anuraaga): It might be possible to share the optimized loop with
+ // readStringRequireUtf8 by implementing Java replacement logic there.
// The same as readBytes' logic
byte[] bytes = new byte[size];
UnsafeUtil.copyMemory(pos, bytes, 0, size);
@@ -1544,19 +1560,26 @@ public abstract class CodedInputStream {
@Override
public String readStringRequireUtf8() throws IOException {
final int size = readRawVarint32();
- if (size >= 0 && size <= remaining()) {
- // TODO(nathanmittler): Is there a way to avoid this copy?
- // The same as readBytes' logic
- byte[] bytes = new byte[size];
- UnsafeUtil.copyMemory(pos, bytes, 0, size);
- // TODO(martinrb): We could save a pass by validating while decoding.
- if (!Utf8.isValidUtf8(bytes)) {
- throw InvalidProtocolBufferException.invalidUtf8();
- }
+ if (size > 0 && size <= remaining()) {
+ if (ENABLE_CUSTOM_UTF8_DECODE) {
+ final int bufferPos = bufferPos(pos);
+ String result = Utf8.decodeUtf8(buffer, bufferPos, size);
+ pos += size;
+ return result;
+ } else {
+ // TODO(nathanmittler): Is there a way to avoid this copy?
+ // The same as readBytes' logic
+ byte[] bytes = new byte[size];
+ UnsafeUtil.copyMemory(pos, bytes, 0, size);
+ // TODO(martinrb): We could save a pass by validating while decoding.
+ if (!Utf8.isValidUtf8(bytes)) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
- String result = new String(bytes, UTF_8);
- pos += size;
- return result;
+ String result = new String(bytes, UTF_8);
+ pos += size;
+ return result;
+ }
}
if (size == 0) {
@@ -2324,11 +2347,15 @@ public abstract class CodedInputStream {
bytes = readRawBytesSlowPath(size);
tempPos = 0;
}
- // TODO(martinrb): We could save a pass by validating while decoding.
- if (!Utf8.isValidUtf8(bytes, tempPos, tempPos + size)) {
- throw InvalidProtocolBufferException.invalidUtf8();
+ if (ENABLE_CUSTOM_UTF8_DECODE) {
+ return Utf8.decodeUtf8(bytes, tempPos, size);
+ } else {
+ // TODO(martinrb): We could save a pass by validating while decoding.
+ if (!Utf8.isValidUtf8(bytes, tempPos, tempPos + size)) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ return new String(bytes, tempPos, size, UTF_8);
}
- return new String(bytes, tempPos, size, UTF_8);
}
@Override
@@ -3348,23 +3375,34 @@ public abstract class CodedInputStream {
public String readStringRequireUtf8() throws IOException {
final int size = readRawVarint32();
if (size > 0 && size <= currentByteBufferLimit - currentByteBufferPos) {
- byte[] bytes = new byte[size];
- UnsafeUtil.copyMemory(currentByteBufferPos, bytes, 0, size);
- if (!Utf8.isValidUtf8(bytes)) {
- throw InvalidProtocolBufferException.invalidUtf8();
+ if (ENABLE_CUSTOM_UTF8_DECODE) {
+ final int bufferPos = (int) (currentByteBufferPos - currentByteBufferStartPos);
+ String result = Utf8.decodeUtf8(currentByteBuffer, bufferPos, size);
+ currentByteBufferPos += size;
+ return result;
+ } else {
+ byte[] bytes = new byte[size];
+ UnsafeUtil.copyMemory(currentByteBufferPos, bytes, 0, size);
+ if (!Utf8.isValidUtf8(bytes)) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ String result = new String(bytes, UTF_8);
+ currentByteBufferPos += size;
+ return result;
}
- String result = new String(bytes, UTF_8);
- currentByteBufferPos += size;
- return result;
}
if (size >= 0 && size <= remaining()) {
byte[] bytes = new byte[size];
readRawBytesTo(bytes, 0, size);
- if (!Utf8.isValidUtf8(bytes)) {
- throw InvalidProtocolBufferException.invalidUtf8();
+ if (ENABLE_CUSTOM_UTF8_DECODE) {
+ return Utf8.decodeUtf8(bytes, 0, size);
+ } else {
+ if (!Utf8.isValidUtf8(bytes)) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ String result = new String(bytes, UTF_8);
+ return result;
}
- String result = new String(bytes, UTF_8);
- return result;
}
if (size == 0) {
diff --git a/java/core/src/main/java/com/google/protobuf/FieldSet.java b/java/core/src/main/java/com/google/protobuf/FieldSet.java
index 8a9239ed..c09daa32 100644
--- a/java/core/src/main/java/com/google/protobuf/FieldSet.java
+++ b/java/core/src/main/java/com/google/protobuf/FieldSet.java
@@ -102,6 +102,11 @@ final class FieldSet<FieldDescriptorType extends
@SuppressWarnings("rawtypes")
private static final FieldSet DEFAULT_INSTANCE = new FieldSet(true);
+ /** Returns {@code true} if empty, {@code false} otherwise. */
+ boolean isEmpty() {
+ return fields.isEmpty();
+ }
+
/** Make this FieldSet immutable from this point forward. */
@SuppressWarnings("unchecked")
public void makeImmutable() {
diff --git a/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java b/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java
index 09084646..8b8d9fc6 100644
--- a/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java
+++ b/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java
@@ -504,11 +504,8 @@ public abstract class GeneratedMessageLite<
extends GeneratedMessageLite<MessageType, BuilderType>
implements ExtendableMessageOrBuilder<MessageType, BuilderType> {
- /**
- * Represents the set of extensions on this message. For use by generated
- * code only.
- */
- protected FieldSet<ExtensionDescriptor> extensions = FieldSet.newFieldSet();
+ /** Represents the set of extensions on this message. For use by generated code only. */
+ protected FieldSet<ExtensionDescriptor> extensions = FieldSet.emptySet();
@SuppressWarnings("unchecked")
protected final void mergeExtensionFields(final MessageType other) {
@@ -578,7 +575,11 @@ public abstract class GeneratedMessageLite<
if (unknown) { // Unknown field or wrong wire type. Skip.
return parseUnknownField(tag, input);
}
-
+
+ if (extensions.isImmutable()) {
+ extensions = extensions.clone();
+ }
+
if (packed) {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
@@ -942,12 +943,6 @@ public abstract class GeneratedMessageLite<
implements ExtendableMessageOrBuilder<MessageType, BuilderType> {
protected ExtendableBuilder(MessageType defaultInstance) {
super(defaultInstance);
-
- // TODO(dweis): This is kind of an unnecessary clone since we construct a
- // new instance in the parent constructor which makes the extensions
- // immutable. This extra allocation shouldn't matter in practice
- // though.
- instance.extensions = instance.extensions.clone();
}
// For immutable message conversion.
@@ -966,6 +961,15 @@ public abstract class GeneratedMessageLite<
instance.extensions = instance.extensions.clone();
}
+ private FieldSet<ExtensionDescriptor> ensureExtensionsAreMutable() {
+ FieldSet<ExtensionDescriptor> extensions = instance.extensions;
+ if (extensions.isImmutable()) {
+ extensions = extensions.clone();
+ instance.extensions = extensions;
+ }
+ return extensions;
+ }
+
@Override
public final MessageType buildPartial() {
if (isBuilt) {
@@ -1024,7 +1028,8 @@ public abstract class GeneratedMessageLite<
verifyExtensionContainingType(extensionLite);
copyOnWrite();
- instance.extensions.setField(extensionLite.descriptor, extensionLite.toFieldSetType(value));
+ ensureExtensionsAreMutable()
+ .setField(extensionLite.descriptor, extensionLite.toFieldSetType(value));
return (BuilderType) this;
}
@@ -1037,8 +1042,9 @@ public abstract class GeneratedMessageLite<
verifyExtensionContainingType(extensionLite);
copyOnWrite();
- instance.extensions.setRepeatedField(
- extensionLite.descriptor, index, extensionLite.singularToFieldSetType(value));
+ ensureExtensionsAreMutable()
+ .setRepeatedField(
+ extensionLite.descriptor, index, extensionLite.singularToFieldSetType(value));
return (BuilderType) this;
}
@@ -1051,8 +1057,8 @@ public abstract class GeneratedMessageLite<
verifyExtensionContainingType(extensionLite);
copyOnWrite();
- instance.extensions.addRepeatedField(
- extensionLite.descriptor, extensionLite.singularToFieldSetType(value));
+ ensureExtensionsAreMutable()
+ .addRepeatedField(extensionLite.descriptor, extensionLite.singularToFieldSetType(value));
return (BuilderType) this;
}
@@ -1063,7 +1069,7 @@ public abstract class GeneratedMessageLite<
verifyExtensionContainingType(extensionLite);
copyOnWrite();
- instance.extensions.clearField(extensionLite.descriptor);
+ ensureExtensionsAreMutable().clearField(extensionLite.descriptor);
return (BuilderType) this;
}
}
diff --git a/java/core/src/main/java/com/google/protobuf/TextFormat.java b/java/core/src/main/java/com/google/protobuf/TextFormat.java
index ab9acf2f..0c8b898c 100644
--- a/java/core/src/main/java/com/google/protobuf/TextFormat.java
+++ b/java/core/src/main/java/com/google/protobuf/TextFormat.java
@@ -1224,6 +1224,22 @@ public final class TextFormat {
}
/**
+ * Parse a text-format message from {@code input}.
+ *
+ * @return the parsed message, guaranteed initialized
+ */
+ public static <T extends Message> T parse(final CharSequence input,
+ final Class<T> protoClass)
+ throws ParseException {
+ Message.Builder builder =
+ Internal.getDefaultInstance(protoClass).newBuilderForType();
+ merge(input, builder);
+ @SuppressWarnings("unchecked")
+ T output = (T) builder.build();
+ return output;
+ }
+
+ /**
* Parse a text-format message from {@code input} and merge the contents
* into {@code builder}. Extensions will be recognized if they are
* registered in {@code extensionRegistry}.
@@ -1248,6 +1264,25 @@ public final class TextFormat {
PARSER.merge(input, extensionRegistry, builder);
}
+ /**
+ * Parse a text-format message from {@code input}. Extensions will be
+ * recognized if they are registered in {@code extensionRegistry}.
+ *
+ * @return the parsed message, guaranteed initialized
+ */
+ public static <T extends Message> T parse(
+ final CharSequence input,
+ final ExtensionRegistry extensionRegistry,
+ final Class<T> protoClass)
+ throws ParseException {
+ Message.Builder builder =
+ Internal.getDefaultInstance(protoClass).newBuilderForType();
+ merge(input, extensionRegistry, builder);
+ @SuppressWarnings("unchecked")
+ T output = (T) builder.build();
+ return output;
+ }
+
/**
* Parser for text-format proto2 instances. This class is thread-safe.
diff --git a/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java b/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java
index 88315cb6..b09ff673 100644
--- a/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java
+++ b/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java
@@ -33,7 +33,6 @@ package com.google.protobuf;
import java.lang.reflect.Field;
import java.nio.Buffer;
import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import java.util.logging.Level;
@@ -72,6 +71,8 @@ final class UnsafeUtil {
private static final long BUFFER_ADDRESS_OFFSET = fieldOffset(bufferAddressField());
+ private static final long STRING_VALUE_OFFSET = fieldOffset(stringValueField());
+
private UnsafeUtil() {}
static boolean hasUnsafeArrayOperations() {
@@ -259,6 +260,26 @@ final class UnsafeUtil {
return MEMORY_ACCESSOR.getLong(buffer, BUFFER_ADDRESS_OFFSET);
}
+ /**
+ * Returns a new {@link String} backed by the given {@code chars}. The char array should not
+ * be mutated any more after calling this function.
+ */
+ static String moveToString(char[] chars) {
+ if (STRING_VALUE_OFFSET == -1) {
+ // In the off-chance that this JDK does not implement String as we'd expect, just do a copy.
+ return new String(chars);
+ }
+ final String str;
+ try {
+ str = (String) UNSAFE.allocateInstance(String.class);
+ } catch (InstantiationException e) {
+ // This should never happen, but return a copy as a fallback just in case.
+ return new String(chars);
+ }
+ putObject(str, STRING_VALUE_OFFSET, chars);
+ return str;
+ }
+
static Object getStaticObject(Field field) {
return MEMORY_ACCESSOR.getStaticObject(field);
}
@@ -364,18 +385,14 @@ final class UnsafeUtil {
}
- @SuppressWarnings("unchecked")
- private static <T> Class<T> getClassForName(String name) {
- try {
- return (Class<T>) Class.forName(name);
- } catch (Throwable e) {
- return null;
- }
- }
-
/** Finds the address field within a direct {@link Buffer}. */
private static Field bufferAddressField() {
- return field(Buffer.class, "address");
+ return field(Buffer.class, "address", long.class);
+ }
+
+ /** Finds the value field within a {@link String}. */
+ private static Field stringValueField() {
+ return field(String.class, "value", char[].class);
}
/**
@@ -390,11 +407,14 @@ final class UnsafeUtil {
* Gets the field with the given name within the class, or {@code null} if not found. If found,
* the field is made accessible.
*/
- private static Field field(Class<?> clazz, String fieldName) {
+ private static Field field(Class<?> clazz, String fieldName, Class<?> expectedType) {
Field field;
try {
field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
+ if (!field.getType().equals(expectedType)) {
+ return null;
+ }
} catch (Throwable t) {
// Failed to access the fields.
field = null;
diff --git a/java/core/src/main/java/com/google/protobuf/Utf8.java b/java/core/src/main/java/com/google/protobuf/Utf8.java
index 1b136144..6968abb3 100644
--- a/java/core/src/main/java/com/google/protobuf/Utf8.java
+++ b/java/core/src/main/java/com/google/protobuf/Utf8.java
@@ -34,11 +34,15 @@ import static com.google.protobuf.UnsafeUtil.addressOffset;
import static com.google.protobuf.UnsafeUtil.hasUnsafeArrayOperations;
import static com.google.protobuf.UnsafeUtil.hasUnsafeByteBufferOperations;
import static java.lang.Character.MAX_SURROGATE;
+import static java.lang.Character.MIN_HIGH_SURROGATE;
+import static java.lang.Character.MIN_LOW_SURROGATE;
+import static java.lang.Character.MIN_SUPPLEMENTARY_CODE_POINT;
import static java.lang.Character.MIN_SURROGATE;
import static java.lang.Character.isSurrogatePair;
import static java.lang.Character.toCodePoint;
import java.nio.ByteBuffer;
+import java.util.Arrays;
/**
* A set of low-level, high-performance static utility methods related
@@ -289,7 +293,7 @@ final class Utf8 {
if (Character.MIN_SURROGATE <= c && c <= Character.MAX_SURROGATE) {
// Check that we have a well-formed surrogate pair.
int cp = Character.codePointAt(sequence, i);
- if (cp < Character.MIN_SUPPLEMENTARY_CODE_POINT) {
+ if (cp < MIN_SUPPLEMENTARY_CODE_POINT) {
throw new UnpairedSurrogateException(i, utf16Length);
}
i++;
@@ -331,6 +335,26 @@ final class Utf8 {
}
/**
+ * Decodes the given UTF-8 portion of the {@link ByteBuffer} into a {@link String}.
+ *
+ * @throws InvalidProtocolBufferException if the input is not valid UTF-8.
+ */
+ static String decodeUtf8(ByteBuffer buffer, int index, int size)
+ throws InvalidProtocolBufferException {
+ return processor.decodeUtf8(buffer, index, size);
+ }
+
+ /**
+ * Decodes the given UTF-8 encoded byte array slice into a {@link String}.
+ *
+ * @throws InvalidProtocolBufferException if the input is not valid UTF-8.
+ */
+ static String decodeUtf8(byte[] bytes, int index, int size)
+ throws InvalidProtocolBufferException {
+ return processor.decodeUtf8(bytes, index, size);
+ }
+
+ /**
* Encodes the given characters to the target {@link ByteBuffer} using UTF-8 encoding.
*
* <p>Selects an optimal algorithm based on the type of {@link ByteBuffer} (i.e. heap or direct)
@@ -610,6 +634,116 @@ final class Utf8 {
}
/**
+ * Decodes the given byte array slice into a {@link String}.
+ *
+ * @throws InvalidProtocolBufferException if the byte array slice is not valid UTF-8.
+ */
+ abstract String decodeUtf8(byte[] bytes, int index, int size)
+ throws InvalidProtocolBufferException;
+
+ /**
+ * Decodes the given portion of the {@link ByteBuffer} into a {@link String}.
+ *
+ * @throws InvalidProtocolBufferException if the portion of the buffer is not valid UTF-8.
+ */
+ final String decodeUtf8(ByteBuffer buffer, int index, int size)
+ throws InvalidProtocolBufferException {
+ if (buffer.hasArray()) {
+ final int offset = buffer.arrayOffset();
+ return decodeUtf8(buffer.array(), offset + index, size);
+ } else if (buffer.isDirect()) {
+ return decodeUtf8Direct(buffer, index, size);
+ }
+ return decodeUtf8Default(buffer, index, size);
+ }
+
+ /**
+ * Decodes direct {@link ByteBuffer} instances into {@link String}.
+ */
+ abstract String decodeUtf8Direct(ByteBuffer buffer, int index, int size)
+ throws InvalidProtocolBufferException;
+
+ /**
+ * Decodes {@link ByteBuffer} instances using the {@link ByteBuffer} API rather than
+ * potentially faster approaches.
+ */
+ final String decodeUtf8Default(ByteBuffer buffer, int index, int size)
+ throws InvalidProtocolBufferException {
+ // Bitwise OR combines the sign bits so any negative value fails the check.
+ if ((index | size | buffer.limit() - index - size) < 0) {
+ throw new ArrayIndexOutOfBoundsException(
+ String.format("buffer limit=%d, index=%d, limit=%d", buffer.limit(), index, size));
+ }
+
+ int offset = index;
+ final int limit = offset + size;
+
+ // The longest possible resulting String is the same as the number of input bytes, when it is
+ // all ASCII. For other cases, this over-allocates and we will truncate in the end.
+ char[] resultArr = new char[size];
+ int resultPos = 0;
+
+ // Optimize for 100% ASCII (Hotspot loves small simple top-level loops like this).
+ // This simple loop stops when we encounter a byte >= 0x80 (i.e. non-ASCII).
+ while (offset < limit) {
+ byte b = buffer.get(offset);
+ if (!DecodeUtil.isOneByte(b)) {
+ break;
+ }
+ offset++;
+ DecodeUtil.handleOneByte(b, resultArr, resultPos++);
+ }
+
+ while (offset < limit) {
+ byte byte1 = buffer.get(offset++);
+ if (DecodeUtil.isOneByte(byte1)) {
+ DecodeUtil.handleOneByte(byte1, resultArr, resultPos++);
+ // It's common for there to be multiple ASCII characters in a run mixed in, so add an
+ // extra optimized loop to take care of these runs.
+ while (offset < limit) {
+ byte b = buffer.get(offset);
+ if (!DecodeUtil.isOneByte(b)) {
+ break;
+ }
+ offset++;
+ DecodeUtil.handleOneByte(b, resultArr, resultPos++);
+ }
+ } else if (DecodeUtil.isTwoBytes(byte1)) {
+ if (offset >= limit) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ DecodeUtil.handleTwoBytes(
+ byte1, /* byte2 */ buffer.get(offset++), resultArr, resultPos++);
+ } else if (DecodeUtil.isThreeBytes(byte1)) {
+ if (offset >= limit - 1) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ DecodeUtil.handleThreeBytes(
+ byte1,
+ /* byte2 */ buffer.get(offset++),
+ /* byte3 */ buffer.get(offset++),
+ resultArr,
+ resultPos++);
+ } else {
+ if (offset >= limit - 2) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ DecodeUtil.handleFourBytes(
+ byte1,
+ /* byte2 */ buffer.get(offset++),
+ /* byte3 */ buffer.get(offset++),
+ /* byte4 */ buffer.get(offset++),
+ resultArr,
+ resultPos++);
+ // 4-byte case requires two chars.
+ resultPos++;
+ }
+ }
+
+ return new String(resultArr, 0, resultPos);
+ }
+
+ /**
* Encodes an input character sequence ({@code in}) to UTF-8 in the target array ({@code out}).
* For a string, this method is similar to
* <pre>{@code
@@ -851,6 +985,88 @@ final class Utf8 {
}
@Override
+ String decodeUtf8(byte[] bytes, int index, int size) throws InvalidProtocolBufferException {
+ // Bitwise OR combines the sign bits so any negative value fails the check.
+ if ((index | size | bytes.length - index - size) < 0) {
+ throw new ArrayIndexOutOfBoundsException(
+ String.format("buffer length=%d, index=%d, size=%d", bytes.length, index, size));
+ }
+
+ int offset = index;
+ final int limit = offset + size;
+
+ // The longest possible resulting String is the same as the number of input bytes, when it is
+ // all ASCII. For other cases, this over-allocates and we will truncate in the end.
+ char[] resultArr = new char[size];
+ int resultPos = 0;
+
+ // Optimize for 100% ASCII (Hotspot loves small simple top-level loops like this).
+ // This simple loop stops when we encounter a byte >= 0x80 (i.e. non-ASCII).
+ while (offset < limit) {
+ byte b = bytes[offset];
+ if (!DecodeUtil.isOneByte(b)) {
+ break;
+ }
+ offset++;
+ DecodeUtil.handleOneByte(b, resultArr, resultPos++);
+ }
+
+ while (offset < limit) {
+ byte byte1 = bytes[offset++];
+ if (DecodeUtil.isOneByte(byte1)) {
+ DecodeUtil.handleOneByte(byte1, resultArr, resultPos++);
+ // It's common for there to be multiple ASCII characters in a run mixed in, so add an
+ // extra optimized loop to take care of these runs.
+ while (offset < limit) {
+ byte b = bytes[offset];
+ if (!DecodeUtil.isOneByte(b)) {
+ break;
+ }
+ offset++;
+ DecodeUtil.handleOneByte(b, resultArr, resultPos++);
+ }
+ } else if (DecodeUtil.isTwoBytes(byte1)) {
+ if (offset >= limit) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ DecodeUtil.handleTwoBytes(byte1, /* byte2 */ bytes[offset++], resultArr, resultPos++);
+ } else if (DecodeUtil.isThreeBytes(byte1)) {
+ if (offset >= limit - 1) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ DecodeUtil.handleThreeBytes(
+ byte1,
+ /* byte2 */ bytes[offset++],
+ /* byte3 */ bytes[offset++],
+ resultArr,
+ resultPos++);
+ } else {
+ if (offset >= limit - 2) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ DecodeUtil.handleFourBytes(
+ byte1,
+ /* byte2 */ bytes[offset++],
+ /* byte3 */ bytes[offset++],
+ /* byte4 */ bytes[offset++],
+ resultArr,
+ resultPos++);
+ // 4-byte case requires two chars.
+ resultPos++;
+ }
+ }
+
+ return new String(resultArr, 0, resultPos);
+ }
+
+ @Override
+ String decodeUtf8Direct(ByteBuffer buffer, int index, int size)
+ throws InvalidProtocolBufferException {
+ // For safe processing, we have to use the ByteBufferAPI.
+ return decodeUtf8Default(buffer, index, size);
+ }
+
+ @Override
int encodeUtf8(CharSequence in, byte[] out, int offset, int length) {
int utf16Length = in.length();
int j = offset;
@@ -996,6 +1212,7 @@ final class Utf8 {
@Override
int partialIsValidUtf8(int state, byte[] bytes, final int index, final int limit) {
+ // Bitwise OR combines the sign bits so any negative value fails the check.
if ((index | limit | bytes.length - limit) < 0) {
throw new ArrayIndexOutOfBoundsException(
String.format("Array length=%d, index=%d, limit=%d", bytes.length, index, limit));
@@ -1091,6 +1308,7 @@ final class Utf8 {
@Override
int partialIsValidUtf8Direct(
final int state, ByteBuffer buffer, final int index, final int limit) {
+ // Bitwise OR combines the sign bits so any negative value fails the check.
if ((index | limit | buffer.limit() - limit) < 0) {
throw new ArrayIndexOutOfBoundsException(
String.format("buffer limit=%d, index=%d, limit=%d", buffer.limit(), index, limit));
@@ -1185,6 +1403,163 @@ final class Utf8 {
}
@Override
+ String decodeUtf8(byte[] bytes, int index, int size) throws InvalidProtocolBufferException {
+ if ((index | size | bytes.length - index - size) < 0) {
+ throw new ArrayIndexOutOfBoundsException(
+ String.format("buffer length=%d, index=%d, size=%d", bytes.length, index, size));
+ }
+
+ int offset = index;
+ final int limit = offset + size;
+
+ // The longest possible resulting String is the same as the number of input bytes, when it is
+ // all ASCII. For other cases, this over-allocates and we will truncate in the end.
+ char[] resultArr = new char[size];
+ int resultPos = 0;
+
+ // Optimize for 100% ASCII (Hotspot loves small simple top-level loops like this).
+ // This simple loop stops when we encounter a byte >= 0x80 (i.e. non-ASCII).
+ while (offset < limit) {
+ byte b = UnsafeUtil.getByte(bytes, offset);
+ if (!DecodeUtil.isOneByte(b)) {
+ break;
+ }
+ offset++;
+ DecodeUtil.handleOneByte(b, resultArr, resultPos++);
+ }
+
+ while (offset < limit) {
+ byte byte1 = UnsafeUtil.getByte(bytes, offset++);
+ if (DecodeUtil.isOneByte(byte1)) {
+ DecodeUtil.handleOneByte(byte1, resultArr, resultPos++);
+ // It's common for there to be multiple ASCII characters in a run mixed in, so add an
+ // extra optimized loop to take care of these runs.
+ while (offset < limit) {
+ byte b = UnsafeUtil.getByte(bytes, offset);
+ if (!DecodeUtil.isOneByte(b)) {
+ break;
+ }
+ offset++;
+ DecodeUtil.handleOneByte(b, resultArr, resultPos++);
+ }
+ } else if (DecodeUtil.isTwoBytes(byte1)) {
+ if (offset >= limit) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ DecodeUtil.handleTwoBytes(
+ byte1, /* byte2 */ UnsafeUtil.getByte(bytes, offset++), resultArr, resultPos++);
+ } else if (DecodeUtil.isThreeBytes(byte1)) {
+ if (offset >= limit - 1) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ DecodeUtil.handleThreeBytes(
+ byte1,
+ /* byte2 */ UnsafeUtil.getByte(bytes, offset++),
+ /* byte3 */ UnsafeUtil.getByte(bytes, offset++),
+ resultArr,
+ resultPos++);
+ } else {
+ if (offset >= limit - 2) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ DecodeUtil.handleFourBytes(
+ byte1,
+ /* byte2 */ UnsafeUtil.getByte(bytes, offset++),
+ /* byte3 */ UnsafeUtil.getByte(bytes, offset++),
+ /* byte4 */ UnsafeUtil.getByte(bytes, offset++),
+ resultArr,
+ resultPos++);
+ // 4-byte case requires two chars.
+ resultPos++;
+ }
+ }
+
+ if (resultPos < resultArr.length) {
+ resultArr = Arrays.copyOf(resultArr, resultPos);
+ }
+ return UnsafeUtil.moveToString(resultArr);
+ }
+
+ @Override
+ String decodeUtf8Direct(ByteBuffer buffer, int index, int size)
+ throws InvalidProtocolBufferException {
+ // Bitwise OR combines the sign bits so any negative value fails the check.
+ if ((index | size | buffer.limit() - index - size) < 0) {
+ throw new ArrayIndexOutOfBoundsException(
+ String.format("buffer limit=%d, index=%d, limit=%d", buffer.limit(), index, size));
+ }
+ long address = UnsafeUtil.addressOffset(buffer) + index;
+ final long addressLimit = address + size;
+
+ // The longest possible resulting String is the same as the number of input bytes, when it is
+ // all ASCII. For other cases, this over-allocates and we will truncate in the end.
+ char[] resultArr = new char[size];
+ int resultPos = 0;
+
+ // Optimize for 100% ASCII (Hotspot loves small simple top-level loops like this).
+ // This simple loop stops when we encounter a byte >= 0x80 (i.e. non-ASCII).
+ while (address < addressLimit) {
+ byte b = UnsafeUtil.getByte(address);
+ if (!DecodeUtil.isOneByte(b)) {
+ break;
+ }
+ address++;
+ DecodeUtil.handleOneByte(b, resultArr, resultPos++);
+ }
+
+ while (address < addressLimit) {
+ byte byte1 = UnsafeUtil.getByte(address++);
+ if (DecodeUtil.isOneByte(byte1)) {
+ DecodeUtil.handleOneByte(byte1, resultArr, resultPos++);
+ // It's common for there to be multiple ASCII characters in a run mixed in, so add an
+ // extra optimized loop to take care of these runs.
+ while (address < addressLimit) {
+ byte b = UnsafeUtil.getByte(address);
+ if (!DecodeUtil.isOneByte(b)) {
+ break;
+ }
+ address++;
+ DecodeUtil.handleOneByte(b, resultArr, resultPos++);
+ }
+ } else if (DecodeUtil.isTwoBytes(byte1)) {
+ if (address >= addressLimit) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ DecodeUtil.handleTwoBytes(
+ byte1, /* byte2 */ UnsafeUtil.getByte(address++), resultArr, resultPos++);
+ } else if (DecodeUtil.isThreeBytes(byte1)) {
+ if (address >= addressLimit - 1) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ DecodeUtil.handleThreeBytes(
+ byte1,
+ /* byte2 */ UnsafeUtil.getByte(address++),
+ /* byte3 */ UnsafeUtil.getByte(address++),
+ resultArr,
+ resultPos++);
+ } else {
+ if (address >= addressLimit - 2) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ DecodeUtil.handleFourBytes(
+ byte1,
+ /* byte2 */ UnsafeUtil.getByte(address++),
+ /* byte3 */ UnsafeUtil.getByte(address++),
+ /* byte4 */ UnsafeUtil.getByte(address++),
+ resultArr,
+ resultPos++);
+ // 4-byte case requires two chars.
+ resultPos++;
+ }
+ }
+
+ if (resultPos < resultArr.length) {
+ resultArr = Arrays.copyOf(resultArr, resultPos);
+ }
+ return UnsafeUtil.moveToString(resultArr);
+ }
+
+ @Override
int encodeUtf8(final CharSequence in, final byte[] out, final int offset, final int length) {
long outIx = offset;
final long outLimit = outIx + length;
@@ -1554,5 +1929,112 @@ final class Utf8 {
}
}
+ /**
+ * Utility methods for decoding bytes into {@link String}. Callers are responsible for extracting
+ * bytes (possibly using Unsafe methods), and checking remaining bytes. All other UTF-8 validity
+ * checks and codepoint conversion happen in this class.
+ */
+ private static class DecodeUtil {
+
+ /**
+ * Returns whether this is a single-byte codepoint (i.e., ASCII) with the form '0XXXXXXX'.
+ */
+ private static boolean isOneByte(byte b) {
+ return b >= 0;
+ }
+
+ /**
+ * Returns whether this is a two-byte codepoint with the form '10XXXXXX'.
+ */
+ private static boolean isTwoBytes(byte b) {
+ return b < (byte) 0xE0;
+ }
+
+ /**
+ * Returns whether this is a three-byte codepoint with the form '110XXXXX'.
+ */
+ private static boolean isThreeBytes(byte b) {
+ return b < (byte) 0xF0;
+ }
+
+ private static void handleOneByte(byte byte1, char[] resultArr, int resultPos) {
+ resultArr[resultPos] = (char) byte1;
+ }
+
+ private static void handleTwoBytes(
+ byte byte1, byte byte2, char[] resultArr, int resultPos)
+ throws InvalidProtocolBufferException {
+ // Simultaneously checks for illegal trailing-byte in leading position (<= '11000000') and
+ // overlong 2-byte, '11000001'.
+ if (byte1 < (byte) 0xC2
+ || isNotTrailingByte(byte2)) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ resultArr[resultPos] = (char) (((byte1 & 0x1F) << 6) | trailingByteValue(byte2));
+ }
+
+ private static void handleThreeBytes(
+ byte byte1, byte byte2, byte byte3, char[] resultArr, int resultPos)
+ throws InvalidProtocolBufferException {
+ if (isNotTrailingByte(byte2)
+ // overlong? 5 most significant bits must not all be zero
+ || (byte1 == (byte) 0xE0 && byte2 < (byte) 0xA0)
+ // check for illegal surrogate codepoints
+ || (byte1 == (byte) 0xED && byte2 >= (byte) 0xA0)
+ || isNotTrailingByte(byte3)) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ resultArr[resultPos] = (char)
+ (((byte1 & 0x0F) << 12) | (trailingByteValue(byte2) << 6) | trailingByteValue(byte3));
+ }
+
+ private static void handleFourBytes(
+ byte byte1, byte byte2, byte byte3, byte byte4, char[] resultArr, int resultPos)
+ throws InvalidProtocolBufferException{
+ if (isNotTrailingByte(byte2)
+ // Check that 1 <= plane <= 16. Tricky optimized form of:
+ // valid 4-byte leading byte?
+ // if (byte1 > (byte) 0xF4 ||
+ // overlong? 4 most significant bits must not all be zero
+ // byte1 == (byte) 0xF0 && byte2 < (byte) 0x90 ||
+ // codepoint larger than the highest code point (U+10FFFF)?
+ // byte1 == (byte) 0xF4 && byte2 > (byte) 0x8F)
+ || (((byte1 << 28) + (byte2 - (byte) 0x90)) >> 30) != 0
+ || isNotTrailingByte(byte3)
+ || isNotTrailingByte(byte4)) {
+ throw InvalidProtocolBufferException.invalidUtf8();
+ }
+ int codepoint = ((byte1 & 0x07) << 18)
+ | (trailingByteValue(byte2) << 12)
+ | (trailingByteValue(byte3) << 6)
+ | trailingByteValue(byte4);
+ resultArr[resultPos] = DecodeUtil.highSurrogate(codepoint);
+ resultArr[resultPos + 1] = DecodeUtil.lowSurrogate(codepoint);
+ }
+
+ /**
+ * Returns whether the byte is not a valid continuation of the form '10XXXXXX'.
+ */
+ private static boolean isNotTrailingByte(byte b) {
+ return b > (byte) 0xBF;
+ }
+
+ /**
+ * Returns the actual value of the trailing byte (removes the prefix '10') for composition.
+ */
+ private static int trailingByteValue(byte b) {
+ return b & 0x3F;
+ }
+
+ private static char highSurrogate(int codePoint) {
+ return (char) ((MIN_HIGH_SURROGATE - (MIN_SUPPLEMENTARY_CODE_POINT >>> 10))
+ + (codePoint >>> 10));
+ }
+
+ private static char lowSurrogate(int codePoint) {
+ return (char) (MIN_LOW_SURROGATE + (codePoint & 0x3ff));
+ }
+ }
+
private Utf8() {}
}
diff --git a/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java b/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java
index 622e36a4..cb2d34eb 100644
--- a/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java
+++ b/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java
@@ -30,6 +30,9 @@
package com.google.protobuf;
+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;
@@ -346,11 +349,6 @@ public class AbstractMessageTest extends TestCase {
// -----------------------------------------------------------------
// Tests for isInitialized().
- private static final TestRequired TEST_REQUIRED_UNINITIALIZED =
- TestRequired.getDefaultInstance();
- private static final TestRequired TEST_REQUIRED_INITIALIZED =
- TestRequired.newBuilder().setA(1).setB(2).setC(3).build();
-
public void testIsInitialized() throws Exception {
TestRequired.Builder builder = TestRequired.newBuilder();
AbstractMessageWrapper.Builder abstractBuilder =
@@ -380,7 +378,7 @@ public class AbstractMessageTest extends TestCase {
builder.setOptionalMessage(TEST_REQUIRED_UNINITIALIZED);
assertFalse(abstractBuilder.isInitialized());
assertEquals(
- "optional_message.a, optional_message.b, optional_message.c",
+ "optional_message.b, optional_message.c",
abstractBuilder.getInitializationErrorString());
builder.setOptionalMessage(TEST_REQUIRED_INITIALIZED);
@@ -390,7 +388,7 @@ public class AbstractMessageTest extends TestCase {
builder.addRepeatedMessage(TEST_REQUIRED_UNINITIALIZED);
assertFalse(abstractBuilder.isInitialized());
assertEquals(
- "repeated_message[0].a, repeated_message[0].b, repeated_message[0].c",
+ "repeated_message[0].b, repeated_message[0].c",
abstractBuilder.getInitializationErrorString());
builder.setRepeatedMessage(0, TEST_REQUIRED_INITIALIZED);
diff --git a/java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java b/java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java
new file mode 100644
index 00000000..359d4d74
--- /dev/null
+++ b/java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java
@@ -0,0 +1,325 @@
+package com.google.protobuf;
+
+import com.google.protobuf.Utf8.Processor;
+import com.google.protobuf.Utf8.SafeProcessor;
+import com.google.protobuf.Utf8.UnsafeProcessor;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+import junit.framework.TestCase;
+
+public class DecodeUtf8Test extends TestCase {
+ private static Logger logger = Logger.getLogger(DecodeUtf8Test.class.getName());
+
+ private static final Processor SAFE_PROCESSOR = new SafeProcessor();
+ private static final Processor UNSAFE_PROCESSOR = new UnsafeProcessor();
+
+ public void testRoundTripAllValidChars() throws Exception {
+ for (int i = Character.MIN_CODE_POINT; i < Character.MAX_CODE_POINT; i++) {
+ if (i < Character.MIN_SURROGATE || i > Character.MAX_SURROGATE) {
+ String str = new String(Character.toChars(i));
+ assertRoundTrips(str);
+ }
+ }
+ }
+
+ // Test all 1, 2, 3 invalid byte combinations. Valid ones would have been covered above.
+
+ public void testOneByte() throws Exception {
+ int valid = 0;
+ for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
+ ByteString bs = ByteString.copyFrom(new byte[] { (byte) i });
+ if (!bs.isValidUtf8()) {
+ assertInvalid(bs.toByteArray());
+ } else {
+ valid++;
+ }
+ }
+ assertEquals(IsValidUtf8TestUtil.EXPECTED_ONE_BYTE_ROUNDTRIPPABLE_COUNT, valid);
+ }
+
+ public void testTwoBytes() throws Exception {
+ int valid = 0;
+ for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
+ for (int j = Byte.MIN_VALUE; j <= Byte.MAX_VALUE; j++) {
+ ByteString bs = ByteString.copyFrom(new byte[]{(byte) i, (byte) j});
+ if (!bs.isValidUtf8()) {
+ assertInvalid(bs.toByteArray());
+ } else {
+ valid++;
+ }
+ }
+ }
+ assertEquals(IsValidUtf8TestUtil.EXPECTED_TWO_BYTE_ROUNDTRIPPABLE_COUNT, valid);
+ }
+
+ public void testThreeBytes() throws Exception {
+ // Travis' OOM killer doesn't like this test
+ if (System.getenv("TRAVIS") == null) {
+ int count = 0;
+ int valid = 0;
+ for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
+ for (int j = Byte.MIN_VALUE; j <= Byte.MAX_VALUE; j++) {
+ for (int k = Byte.MIN_VALUE; k <= Byte.MAX_VALUE; k++) {
+ byte[] bytes = new byte[]{(byte) i, (byte) j, (byte) k};
+ ByteString bs = ByteString.copyFrom(bytes);
+ if (!bs.isValidUtf8()) {
+ assertInvalid(bytes);
+ } else {
+ valid++;
+ }
+ count++;
+ if (count % 1000000L == 0) {
+ logger.info("Processed " + (count / 1000000L) + " million characters");
+ }
+ }
+ }
+ }
+ assertEquals(IsValidUtf8TestUtil.EXPECTED_THREE_BYTE_ROUNDTRIPPABLE_COUNT, valid);
+ }
+ }
+
+ /**
+ * Tests that round tripping of a sample of four byte permutations work.
+ */
+ public void testInvalid_4BytesSamples() throws Exception {
+ // Bad trailing bytes
+ assertInvalid(0xF0, 0xA4, 0xAD, 0x7F);
+ assertInvalid(0xF0, 0xA4, 0xAD, 0xC0);
+
+ // Special cases for byte2
+ assertInvalid(0xF0, 0x8F, 0xAD, 0xA2);
+ assertInvalid(0xF4, 0x90, 0xAD, 0xA2);
+ }
+
+ public void testRealStrings() throws Exception {
+ // English
+ assertRoundTrips("The quick brown fox jumps over the lazy dog");
+ // German
+ assertRoundTrips("Quizdeltagerne spiste jordb\u00e6r med fl\u00f8de, mens cirkusklovnen");
+ // Japanese
+ assertRoundTrips(
+ "\u3044\u308d\u306f\u306b\u307b\u3078\u3068\u3061\u308a\u306c\u308b\u3092");
+ // Hebrew
+ assertRoundTrips(
+ "\u05d3\u05d2 \u05e1\u05e7\u05e8\u05df \u05e9\u05d8 \u05d1\u05d9\u05dd "
+ + "\u05de\u05d0\u05d5\u05db\u05d6\u05d1 \u05d5\u05dc\u05e4\u05ea\u05e2"
+ + " \u05de\u05e6\u05d0 \u05dc\u05d5 \u05d7\u05d1\u05e8\u05d4 "
+ + "\u05d0\u05d9\u05da \u05d4\u05e7\u05dc\u05d9\u05d8\u05d4");
+ // Thai
+ assertRoundTrips(
+ " \u0e08\u0e07\u0e1d\u0e48\u0e32\u0e1f\u0e31\u0e19\u0e1e\u0e31\u0e12"
+ + "\u0e19\u0e32\u0e27\u0e34\u0e0a\u0e32\u0e01\u0e32\u0e23");
+ // Chinese
+ assertRoundTrips(
+ "\u8fd4\u56de\u94fe\u4e2d\u7684\u4e0b\u4e00\u4e2a\u4ee3\u7406\u9879\u9009\u62e9\u5668");
+ // Chinese with 4-byte chars
+ assertRoundTrips("\uD841\uDF0E\uD841\uDF31\uD841\uDF79\uD843\uDC53\uD843\uDC78"
+ + "\uD843\uDC96\uD843\uDCCF\uD843\uDCD5\uD843\uDD15\uD843\uDD7C\uD843\uDD7F"
+ + "\uD843\uDE0E\uD843\uDE0F\uD843\uDE77\uD843\uDE9D\uD843\uDEA2");
+ // Mixed
+ assertRoundTrips(
+ "The quick brown \u3044\u308d\u306f\u306b\u307b\u3078\u8fd4\u56de\u94fe"
+ + "\u4e2d\u7684\u4e0b\u4e00");
+ }
+
+ public void testOverlong() throws Exception {
+ assertInvalid(0xc0, 0xaf);
+ assertInvalid(0xe0, 0x80, 0xaf);
+ assertInvalid(0xf0, 0x80, 0x80, 0xaf);
+
+ // Max overlong
+ assertInvalid(0xc1, 0xbf);
+ assertInvalid(0xe0, 0x9f, 0xbf);
+ assertInvalid(0xf0 ,0x8f, 0xbf, 0xbf);
+
+ // null overlong
+ assertInvalid(0xc0, 0x80);
+ assertInvalid(0xe0, 0x80, 0x80);
+ assertInvalid(0xf0, 0x80, 0x80, 0x80);
+ }
+
+ public void testIllegalCodepoints() throws Exception {
+ // Single surrogate
+ assertInvalid(0xed, 0xa0, 0x80);
+ assertInvalid(0xed, 0xad, 0xbf);
+ assertInvalid(0xed, 0xae, 0x80);
+ assertInvalid(0xed, 0xaf, 0xbf);
+ assertInvalid(0xed, 0xb0, 0x80);
+ assertInvalid(0xed, 0xbe, 0x80);
+ assertInvalid(0xed, 0xbf, 0xbf);
+
+ // Paired surrogates
+ assertInvalid(0xed, 0xa0, 0x80, 0xed, 0xb0, 0x80);
+ assertInvalid(0xed, 0xa0, 0x80, 0xed, 0xbf, 0xbf);
+ assertInvalid(0xed, 0xad, 0xbf, 0xed, 0xb0, 0x80);
+ assertInvalid(0xed, 0xad, 0xbf, 0xed, 0xbf, 0xbf);
+ assertInvalid(0xed, 0xae, 0x80, 0xed, 0xb0, 0x80);
+ assertInvalid(0xed, 0xae, 0x80, 0xed, 0xbf, 0xbf);
+ assertInvalid(0xed, 0xaf, 0xbf, 0xed, 0xb0, 0x80);
+ assertInvalid(0xed, 0xaf, 0xbf, 0xed, 0xbf, 0xbf);
+ }
+
+ public void testBufferSlice() throws Exception {
+ String str = "The quick brown fox jumps over the lazy dog";
+ assertRoundTrips(str, 10, 4);
+ assertRoundTrips(str, str.length(), 0);
+ }
+
+ public void testInvalidBufferSlice() throws Exception {
+ byte[] bytes = "The quick brown fox jumps over the lazy dog".getBytes(Internal.UTF_8);
+ assertInvalidSlice(bytes, bytes.length - 3, 4);
+ assertInvalidSlice(bytes, bytes.length, 1);
+ assertInvalidSlice(bytes, bytes.length + 1, 0);
+ assertInvalidSlice(bytes, 0, bytes.length + 1);
+ }
+
+ private void assertInvalid(int... bytesAsInt) throws Exception {
+ byte[] bytes = new byte[bytesAsInt.length];
+ for (int i = 0; i < bytesAsInt.length; i++) {
+ bytes[i] = (byte) bytesAsInt[i];
+ }
+ assertInvalid(bytes);
+ }
+
+ private void assertInvalid(byte[] bytes) throws Exception {
+ try {
+ UNSAFE_PROCESSOR.decodeUtf8(bytes, 0, bytes.length);
+ fail();
+ } catch (InvalidProtocolBufferException e) {
+ // Expected.
+ }
+ try {
+ SAFE_PROCESSOR.decodeUtf8(bytes, 0, bytes.length);
+ fail();
+ } catch (InvalidProtocolBufferException e) {
+ // Expected.
+ }
+
+ ByteBuffer direct = ByteBuffer.allocateDirect(bytes.length);
+ direct.put(bytes);
+ direct.flip();
+ try {
+ UNSAFE_PROCESSOR.decodeUtf8(direct, 0, bytes.length);
+ fail();
+ } catch (InvalidProtocolBufferException e) {
+ // Expected.
+ }
+ try {
+ SAFE_PROCESSOR.decodeUtf8(direct, 0, bytes.length);
+ fail();
+ } catch (InvalidProtocolBufferException e) {
+ // Expected.
+ }
+
+ ByteBuffer heap = ByteBuffer.allocate(bytes.length);
+ heap.put(bytes);
+ heap.flip();
+ try {
+ UNSAFE_PROCESSOR.decodeUtf8(heap, 0, bytes.length);
+ fail();
+ } catch (InvalidProtocolBufferException e) {
+ // Expected.
+ }
+ try {
+ SAFE_PROCESSOR.decodeUtf8(heap, 0, bytes.length);
+ fail();
+ } catch (InvalidProtocolBufferException e) {
+ // Expected.
+ }
+ }
+
+ private void assertInvalidSlice(byte[] bytes, int index, int size) throws Exception {
+ try {
+ UNSAFE_PROCESSOR.decodeUtf8(bytes, index, size);
+ fail();
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // Expected.
+ }
+ try {
+ SAFE_PROCESSOR.decodeUtf8(bytes, index, size);
+ fail();
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // Expected.
+ }
+
+ ByteBuffer direct = ByteBuffer.allocateDirect(bytes.length);
+ direct.put(bytes);
+ direct.flip();
+ try {
+ UNSAFE_PROCESSOR.decodeUtf8(direct, index, size);
+ fail();
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // Expected.
+ }
+ try {
+ SAFE_PROCESSOR.decodeUtf8(direct, index, size);
+ fail();
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // Expected.
+ }
+
+ ByteBuffer heap = ByteBuffer.allocate(bytes.length);
+ heap.put(bytes);
+ heap.flip();
+ try {
+ UNSAFE_PROCESSOR.decodeUtf8(heap, index, size);
+ fail();
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // Expected.
+ }
+ try {
+ SAFE_PROCESSOR.decodeUtf8(heap, index, size);
+ fail();
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // Expected.
+ }
+ }
+
+ private void assertRoundTrips(String str) throws Exception {
+ assertRoundTrips(str, 0, -1);
+ }
+
+ private void assertRoundTrips(String str, int index, int size) throws Exception {
+ byte[] bytes = str.getBytes(Internal.UTF_8);
+ if (size == -1) {
+ size = bytes.length;
+ }
+ assertDecode(new String(bytes, index, size, Internal.UTF_8),
+ UNSAFE_PROCESSOR.decodeUtf8(bytes, index, size));
+ assertDecode(new String(bytes, index, size, Internal.UTF_8),
+ SAFE_PROCESSOR.decodeUtf8(bytes, index, size));
+
+ ByteBuffer direct = ByteBuffer.allocateDirect(bytes.length);
+ direct.put(bytes);
+ direct.flip();
+ assertDecode(new String(bytes, index, size, Internal.UTF_8),
+ UNSAFE_PROCESSOR.decodeUtf8(direct, index, size));
+ assertDecode(new String(bytes, index, size, Internal.UTF_8),
+ SAFE_PROCESSOR.decodeUtf8(direct, index, size));
+
+ ByteBuffer heap = ByteBuffer.allocate(bytes.length);
+ heap.put(bytes);
+ heap.flip();
+ assertDecode(new String(bytes, index, size, Internal.UTF_8),
+ UNSAFE_PROCESSOR.decodeUtf8(heap, index, size));
+ assertDecode(new String(bytes, index, size, Internal.UTF_8),
+ SAFE_PROCESSOR.decodeUtf8(heap, index, size));
+ }
+
+ private void assertDecode(String expected, String actual) {
+ if (!expected.equals(actual)) {
+ fail("Failure: Expected (" + codepoints(expected) + ") Actual (" + codepoints(actual) + ")");
+ }
+ }
+
+ private List<String> codepoints(String str) {
+ List<String> codepoints = new ArrayList<String>();
+ for (int i = 0; i < str.length(); i++) {
+ codepoints.add(Long.toHexString(str.charAt(i)));
+ }
+ return codepoints;
+ }
+
+}
diff --git a/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java b/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java
index 2c272a73..9c0997c4 100644
--- a/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java
+++ b/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java
@@ -37,22 +37,22 @@ import junit.framework.TestCase;
/**
* Test field deprecation
- *
+ *
* @author birdo@google.com (Roberto Scaramuzzi)
*/
public class DeprecatedFieldTest extends TestCase {
private String[] deprecatedGetterNames = {
"hasDeprecatedInt32",
"getDeprecatedInt32"};
-
+
private String[] deprecatedBuilderGetterNames = {
"hasDeprecatedInt32",
"getDeprecatedInt32",
"clearDeprecatedInt32"};
-
+
private String[] deprecatedBuilderSetterNames = {
- "setDeprecatedInt32"};
-
+ "setDeprecatedInt32"};
+
public void testDeprecatedField() throws Exception {
Class<?> deprecatedFields = TestDeprecatedFields.class;
Class<?> deprecatedFieldsBuilder = TestDeprecatedFields.Builder.class;
@@ -72,7 +72,15 @@ public class DeprecatedFieldTest extends TestCase {
isDeprecated(method));
}
}
-
+
+ public void testDeprecatedFieldInOneof() throws Exception {
+ Class<?> oneofCase = TestDeprecatedFields.OneofFieldsCase.class;
+ String name = "DEPRECATED_INT32_IN_ONEOF";
+ java.lang.reflect.Field enumValue = oneofCase.getField(name);
+ assertTrue("Enum value " + name + " should be deprecated.",
+ isDeprecated(enumValue));
+ }
+
private boolean isDeprecated(AnnotatedElement annotated) {
return annotated.isAnnotationPresent(Deprecated.class);
}
diff --git a/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java b/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java
index 16a808bf..1bcf63e7 100644
--- a/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java
+++ b/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java
@@ -273,6 +273,15 @@ final class IsValidUtf8TestUtil {
assertEquals(isRoundTrippable, Utf8.isValidUtf8(bytes));
assertEquals(isRoundTrippable, Utf8.isValidUtf8(bytes, 0, numBytes));
+ try {
+ assertEquals(s, Utf8.decodeUtf8(bytes, 0, numBytes));
+ } catch (InvalidProtocolBufferException e) {
+ if (isRoundTrippable) {
+ System.out.println("Could not decode utf-8");
+ outputFailure(byteChar, bytes, bytesReencoded);
+ }
+ }
+
// Test partial sequences.
// Partition numBytes into three segments (not necessarily non-empty).
int i = rnd.nextInt(numBytes);
diff --git a/java/core/src/test/java/com/google/protobuf/TestUtil.java b/java/core/src/test/java/com/google/protobuf/TestUtil.java
index e96adf07..b4bc3a3d 100644
--- a/java/core/src/test/java/com/google/protobuf/TestUtil.java
+++ b/java/core/src/test/java/com/google/protobuf/TestUtil.java
@@ -231,6 +231,7 @@ 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 java.io.File;
import java.io.IOException;
@@ -252,6 +253,11 @@ import junit.framework.Assert;
public final class TestUtil {
private TestUtil() {}
+ public static final TestRequired TEST_REQUIRED_UNINITIALIZED =
+ TestRequired.newBuilder().setA(1).buildPartial();
+ public static final TestRequired TEST_REQUIRED_INITIALIZED =
+ TestRequired.newBuilder().setA(1).setB(2).setC(3).build();
+
/** Helper to convert a String to ByteString. */
static ByteString toBytes(String str) {
return ByteString.copyFrom(str.getBytes(Internal.UTF_8));
diff --git a/java/core/src/test/java/com/google/protobuf/TextFormatTest.java b/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
index 28c4fdea..5d38ca51 100644
--- a/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
+++ b/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
@@ -30,6 +30,9 @@
package com.google.protobuf;
+import static com.google.protobuf.TestUtil.TEST_REQUIRED_INITIALIZED;
+import static com.google.protobuf.TestUtil.TEST_REQUIRED_UNINITIALIZED;
+
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
import com.google.protobuf.TextFormat.Parser.SingularOverwritePolicy;
@@ -42,6 +45,7 @@ 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.TestRequired;
import proto2_wireformat_unittest.UnittestMsetWireFormat.TestMessageSet;
import java.io.StringReader;
import java.util.List;
@@ -326,19 +330,58 @@ public class TextFormatTest extends TestCase {
// =================================================================
- public void testParse() throws Exception {
+ public void testMerge() throws Exception {
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
TextFormat.merge(allFieldsSetText, builder);
TestUtil.assertAllFieldsSet(builder.build());
}
- public void testParseReader() throws Exception {
+ public void testParse() throws Exception {
+ TestUtil.assertAllFieldsSet(
+ TextFormat.parse(allFieldsSetText, TestAllTypes.class));
+ }
+
+ public void testMergeInitialized() throws Exception {
+ TestRequired.Builder builder = TestRequired.newBuilder();
+ TextFormat.merge(TEST_REQUIRED_INITIALIZED.toString(), builder);
+ assertEquals(TEST_REQUIRED_INITIALIZED.toString(),
+ builder.buildPartial().toString());
+ assertTrue(builder.isInitialized());
+ }
+
+ public void testParseInitialized() throws Exception {
+ TestRequired parsed =
+ TextFormat.parse(TEST_REQUIRED_INITIALIZED.toString(),
+ TestRequired.class);
+ assertEquals(TEST_REQUIRED_INITIALIZED.toString(), parsed.toString());
+ assertTrue(parsed.isInitialized());
+ }
+
+ public void testMergeUninitialized() throws Exception {
+ TestRequired.Builder builder = TestRequired.newBuilder();
+ TextFormat.merge(TEST_REQUIRED_UNINITIALIZED.toString(), builder);
+ assertEquals(TEST_REQUIRED_UNINITIALIZED.toString(),
+ builder.buildPartial().toString());
+ assertFalse(builder.isInitialized());
+ }
+
+ public void testParseUninitialized() throws Exception {
+ try {
+ TextFormat.parse(TEST_REQUIRED_UNINITIALIZED.toString(),
+ TestRequired.class);
+ fail("Expected UninitializedMessageException.");
+ } catch (UninitializedMessageException e) {
+ assertEquals("Message missing required fields: b, c", e.getMessage());
+ }
+ }
+
+ public void testMergeReader() throws Exception {
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
TextFormat.merge(new StringReader(allFieldsSetText), builder);
TestUtil.assertAllFieldsSet(builder.build());
}
- public void testParseExtensions() throws Exception {
+ public void testMergeExtensions() throws Exception {
TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
TextFormat.merge(allExtensionsSetText,
TestUtil.getExtensionRegistry(),
@@ -346,7 +389,14 @@ public class TextFormatTest extends TestCase {
TestUtil.assertAllExtensionsSet(builder.build());
}
- public void testParseCompatibility() throws Exception {
+ public void testParseExtensions() throws Exception {
+ TestUtil.assertAllExtensionsSet(
+ TextFormat.parse(allExtensionsSetText,
+ TestUtil.getExtensionRegistry(),
+ TestAllExtensions.class));
+ }
+
+ public void testMergeAndParseCompatibility() throws Exception {
String original = "repeated_float: inf\n" +
"repeated_float: -inf\n" +
"repeated_float: nan\n" +
@@ -371,21 +421,29 @@ public class TextFormatTest extends TestCase {
"repeated_double: Infinity\n" +
"repeated_double: -Infinity\n" +
"repeated_double: NaN\n";
+
+ // Test merge().
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
TextFormat.merge(original, builder);
assertEquals(canonical, builder.build().toString());
+
+ // Test parse().
+ assertEquals(canonical,
+ TextFormat.parse(original, TestAllTypes.class).toString());
}
- public void testParseExotic() throws Exception {
+ public void testMergeAndParseExotic() throws Exception {
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
TextFormat.merge(exoticText, builder);
// Too lazy to check things individually. Don't try to debug this
// if testPrintExotic() is failing.
assertEquals(canonicalExoticText, builder.build().toString());
+ assertEquals(canonicalExoticText,
+ TextFormat.parse(exoticText, TestAllTypes.class).toString());
}
- public void testParseMessageSet() throws Exception {
+ public void testMergeMessageSet() throws Exception {
ExtensionRegistry extensionRegistry = ExtensionRegistry.newInstance();
extensionRegistry.add(TestMessageSetExtension1.messageSetExtension);
extensionRegistry.add(TestMessageSetExtension2.messageSetExtension);
@@ -411,7 +469,7 @@ public class TextFormatTest extends TestCase {
TestMessageSetExtension1.messageSetExtension).getI());
}
- public void testParseMessageSetWithOverwriteForbidden() throws Exception {
+ public void testMergeMessageSetWithOverwriteForbidden() throws Exception {
ExtensionRegistry extensionRegistry = ExtensionRegistry.newInstance();
extensionRegistry.add(TestMessageSetExtension1.messageSetExtension);
extensionRegistry.add(TestMessageSetExtension2.messageSetExtension);
@@ -438,20 +496,20 @@ public class TextFormatTest extends TestCase {
}
}
- public void testParseNumericEnum() throws Exception {
+ public void testMergeNumericEnum() throws Exception {
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
TextFormat.merge("optional_nested_enum: 2", builder);
assertEquals(TestAllTypes.NestedEnum.BAR, builder.getOptionalNestedEnum());
}
- public void testParseAngleBrackets() throws Exception {
+ public void testMergeAngleBrackets() throws Exception {
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
TextFormat.merge("OptionalGroup: < a: 1 >", builder);
assertTrue(builder.hasOptionalGroup());
assertEquals(1, builder.getOptionalGroup().getA());
}
- public void testParseComment() throws Exception {
+ public void testMergeComment() throws Exception {
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
TextFormat.merge(
"# this is a comment\n" +
@@ -463,6 +521,7 @@ public class TextFormatTest extends TestCase {
}
private void assertParseError(String error, String text) {
+ // Test merge().
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
try {
TextFormat.merge(text, TestUtil.getExtensionRegistry(), builder);
@@ -470,6 +529,15 @@ public class TextFormatTest extends TestCase {
} catch (TextFormat.ParseException e) {
assertEquals(error, e.getMessage());
}
+
+ // Test parse().
+ try {
+ TextFormat.parse(
+ text, TestUtil.getExtensionRegistry(), TestAllTypes.class);
+ fail("Expected parse exception.");
+ } catch (TextFormat.ParseException e) {
+ assertEquals(error, e.getMessage());
+ }
}
diff --git a/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java b/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
index a26dbc2d..7f69ee68 100644
--- a/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
+++ b/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
@@ -105,7 +105,7 @@ public class JsonFormat {
public static Printer printer() {
return new Printer(
TypeRegistry.getEmptyTypeRegistry(), false, Collections.<FieldDescriptor>emptySet(),
- false, false);
+ false, false, false);
}
/**
@@ -125,18 +125,21 @@ public class JsonFormat {
private Set<FieldDescriptor> includingDefaultValueFields;
private final boolean preservingProtoFieldNames;
private final boolean omittingInsignificantWhitespace;
+ private final boolean printingEnumsAsInts;
private Printer(
TypeRegistry registry,
boolean alwaysOutputDefaultValueFields,
Set<FieldDescriptor> includingDefaultValueFields,
boolean preservingProtoFieldNames,
- boolean omittingInsignificantWhitespace) {
+ boolean omittingInsignificantWhitespace,
+ boolean printingEnumsAsInts) {
this.registry = registry;
this.alwaysOutputDefaultValueFields = alwaysOutputDefaultValueFields;
this.includingDefaultValueFields = includingDefaultValueFields;
this.preservingProtoFieldNames = preservingProtoFieldNames;
this.omittingInsignificantWhitespace = omittingInsignificantWhitespace;
+ this.printingEnumsAsInts = printingEnumsAsInts;
}
/**
@@ -154,7 +157,8 @@ public class JsonFormat {
alwaysOutputDefaultValueFields,
includingDefaultValueFields,
preservingProtoFieldNames,
- omittingInsignificantWhitespace);
+ omittingInsignificantWhitespace,
+ printingEnumsAsInts);
}
/**
@@ -170,7 +174,31 @@ public class JsonFormat {
true,
Collections.<FieldDescriptor>emptySet(),
preservingProtoFieldNames,
- omittingInsignificantWhitespace);
+ omittingInsignificantWhitespace,
+ printingEnumsAsInts);
+ }
+
+ /**
+ * Creates a new {@link Printer} that will print enum field values as integers instead of as
+ * string.
+ * The new Printer clones all other configurations from the current
+ * {@link Printer}.
+ */
+ public Printer printingEnumsAsInts() {
+ checkUnsetPrintingEnumsAsInts();
+ return new Printer(
+ registry,
+ alwaysOutputDefaultValueFields,
+ Collections.<FieldDescriptor>emptySet(),
+ preservingProtoFieldNames,
+ omittingInsignificantWhitespace,
+ true);
+ }
+
+ private void checkUnsetPrintingEnumsAsInts() {
+ if (printingEnumsAsInts) {
+ throw new IllegalStateException("JsonFormat printingEnumsAsInts has already been set.");
+ }
}
/**
@@ -191,7 +219,8 @@ public class JsonFormat {
false,
fieldsToAlwaysOutput,
preservingProtoFieldNames,
- omittingInsignificantWhitespace);
+ omittingInsignificantWhitespace,
+ printingEnumsAsInts);
}
private void checkUnsetIncludingDefaultValueFields() {
@@ -213,7 +242,8 @@ public class JsonFormat {
alwaysOutputDefaultValueFields,
includingDefaultValueFields,
true,
- omittingInsignificantWhitespace);
+ omittingInsignificantWhitespace,
+ printingEnumsAsInts);
}
@@ -240,7 +270,8 @@ public class JsonFormat {
alwaysOutputDefaultValueFields,
includingDefaultValueFields,
preservingProtoFieldNames,
- true);
+ true,
+ printingEnumsAsInts);
}
/**
@@ -259,7 +290,8 @@ public class JsonFormat {
includingDefaultValueFields,
preservingProtoFieldNames,
output,
- omittingInsignificantWhitespace)
+ omittingInsignificantWhitespace,
+ printingEnumsAsInts)
.print(message);
}
@@ -416,7 +448,7 @@ public class JsonFormat {
*/
public Builder add(Iterable<Descriptor> messageTypes) {
if (types == null) {
- throw new IllegalStateException("A TypeRegistry.Builer can only be used once.");
+ throw new IllegalStateException("A TypeRegistry.Builder can only be used once.");
}
for (Descriptor type : messageTypes) {
addFile(type.getFile());
@@ -570,6 +602,7 @@ public class JsonFormat {
private final boolean alwaysOutputDefaultValueFields;
private final Set<FieldDescriptor> includingDefaultValueFields;
private final boolean preservingProtoFieldNames;
+ private final boolean printingEnumsAsInts;
private final TextGenerator generator;
// We use Gson to help handle string escapes.
private final Gson gson;
@@ -586,11 +619,13 @@ public class JsonFormat {
Set<FieldDescriptor> includingDefaultValueFields,
boolean preservingProtoFieldNames,
Appendable jsonOutput,
- boolean omittingInsignificantWhitespace) {
+ boolean omittingInsignificantWhitespace,
+ boolean printingEnumsAsInts) {
this.registry = registry;
this.alwaysOutputDefaultValueFields = alwaysOutputDefaultValueFields;
this.includingDefaultValueFields = includingDefaultValueFields;
this.preservingProtoFieldNames = preservingProtoFieldNames;
+ this.printingEnumsAsInts = printingEnumsAsInts;
this.gson = GsonHolder.DEFAULT_GSON;
// json format related properties, determined by printerType
if (omittingInsignificantWhitespace) {
@@ -1069,7 +1104,7 @@ public class JsonFormat {
generator.print("\"");
}
} else {
- if (((EnumValueDescriptor) value).getIndex() == -1) {
+ if (printingEnumsAsInts || ((EnumValueDescriptor) value).getIndex() == -1) {
generator.print(String.valueOf(((EnumValueDescriptor) value).getNumber()));
} else {
generator.print("\"" + ((EnumValueDescriptor) value).getName() + "\"");
diff --git a/java/util/src/main/java/com/google/protobuf/util/Timestamps.java b/java/util/src/main/java/com/google/protobuf/util/Timestamps.java
index 7a1f2014..9e528d4a 100644
--- a/java/util/src/main/java/com/google/protobuf/util/Timestamps.java
+++ b/java/util/src/main/java/com/google/protobuf/util/Timestamps.java
@@ -74,6 +74,11 @@ public final class Timestamps {
public static final Timestamp MAX_VALUE =
Timestamp.newBuilder().setSeconds(TIMESTAMP_SECONDS_MAX).setNanos(999999999).build();
+ /**
+ * A constant holding the {@link Timestamp} of epoch time, {@code 1970-01-01T00:00:00.000000000Z}.
+ */
+ public static final Timestamp EPOCH = Timestamp.newBuilder().setSeconds(0).setNanos(0).build();
+
private static final ThreadLocal<SimpleDateFormat> timestampFormat =
new ThreadLocal<SimpleDateFormat>() {
@Override
@@ -358,10 +363,12 @@ public final class Timestamps {
static Timestamp normalizedTimestamp(long seconds, int nanos) {
if (nanos <= -NANOS_PER_SECOND || nanos >= NANOS_PER_SECOND) {
seconds = checkedAdd(seconds, nanos / NANOS_PER_SECOND);
- nanos %= NANOS_PER_SECOND;
+ nanos = (int) (nanos % NANOS_PER_SECOND);
}
if (nanos < 0) {
- nanos += NANOS_PER_SECOND; // no overflow since nanos is negative (and we're adding)
+ nanos =
+ (int)
+ (nanos + NANOS_PER_SECOND); // no overflow since nanos is negative (and we're adding)
seconds = checkedSubtract(seconds, 1);
}
Timestamp timestamp = Timestamp.newBuilder().setSeconds(seconds).setNanos(nanos).build();
diff --git a/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java b/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java
index e4c5387a..6ef08508 100644
--- a/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java
+++ b/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java
@@ -1174,6 +1174,14 @@ public class JsonFormatTest extends TestCase {
JsonFormat.parser().ignoringUnknownFields().merge(json, builder);
}
+ public void testParserIntegerEnumValue() throws Exception {
+ TestAllTypes.Builder actualBuilder = TestAllTypes.newBuilder();
+ mergeFromJson("{\n" + " \"optionalNestedEnum\": 2\n" + "}", actualBuilder);
+
+ TestAllTypes expected = TestAllTypes.newBuilder().setOptionalNestedEnum(NestedEnum.BAZ).build();
+ assertEquals(expected, actualBuilder.build());
+ }
+
public void testCustomJsonName() throws Exception {
TestCustomJsonName message = TestCustomJsonName.newBuilder().setValue(12345).build();
assertEquals("{\n" + " \"@value\": 12345\n" + "}", JsonFormat.printer().print(message));
@@ -1441,6 +1449,13 @@ public class JsonFormatTest extends TestCase {
assertEquals(54321, builder.getOptionalInt32());
}
+ public void testPrintingEnumsAsInts() throws Exception {
+ TestAllTypes message = TestAllTypes.newBuilder().setOptionalNestedEnum(NestedEnum.BAR).build();
+ assertEquals(
+ "{\n" + " \"optionalNestedEnum\": 1\n" + "}",
+ JsonFormat.printer().printingEnumsAsInts().print(message));
+ }
+
public void testOmittingInsignificantWhiteSpace() throws Exception {
TestAllTypes message = TestAllTypes.newBuilder().setOptionalInt32(12345).build();
assertEquals(
diff --git a/js/binary/arith.js b/js/binary/arith.js
index 70257de7..62528a26 100644
--- a/js/binary/arith.js
+++ b/js/binary/arith.js
@@ -221,7 +221,7 @@ jspb.arith.UInt64.prototype.mul = function(a) {
* Divide a 64-bit number by a 32-bit number to produce a
* 64-bit quotient and a 32-bit remainder.
* @param {number} _divisor
- * @return {Array.<jspb.arith.UInt64>} array of [quotient, remainder],
+ * @return {Array<jspb.arith.UInt64>} array of [quotient, remainder],
* unless divisor is 0, in which case an empty array is returned.
*/
jspb.arith.UInt64.prototype.div = function(_divisor) {
diff --git a/js/binary/decoder.js b/js/binary/decoder.js
index 4ec3cada..d0c0bc17 100644
--- a/js/binary/decoder.js
+++ b/js/binary/decoder.js
@@ -58,7 +58,7 @@ goog.require('jspb.utils');
* @param {?jspb.BinaryDecoder=} opt_decoder
* @param {?function(this:jspb.BinaryDecoder):(number|boolean|string)=}
* opt_next The decoder method to use for next().
- * @param {?Array.<number|boolean|string>=} opt_elements
+ * @param {?Array<number|boolean|string>=} opt_elements
* @constructor
* @struct
*/
@@ -92,7 +92,7 @@ jspb.BinaryIterator = function(opt_decoder, opt_next, opt_elements) {
* @param {?jspb.BinaryDecoder=} opt_decoder
* @param {?function(this:jspb.BinaryDecoder):(number|boolean|string)=}
* opt_next The decoder method to use for next().
- * @param {?Array.<number|boolean|string>=} opt_elements
+ * @param {?Array<number|boolean|string>=} opt_elements
* @private
*/
jspb.BinaryIterator.prototype.init_ =
@@ -112,7 +112,7 @@ jspb.BinaryIterator.prototype.init_ =
/**
* Global pool of BinaryIterator instances.
- * @private {!Array.<!jspb.BinaryIterator>}
+ * @private {!Array<!jspb.BinaryIterator>}
*/
jspb.BinaryIterator.instanceCache_ = [];
@@ -123,7 +123,7 @@ jspb.BinaryIterator.instanceCache_ = [];
* @param {?jspb.BinaryDecoder=} opt_decoder
* @param {?function(this:jspb.BinaryDecoder):(number|boolean|string)=}
* opt_next The decoder method to use for next().
- * @param {?Array.<number|boolean|string>=} opt_elements
+ * @param {?Array<number|boolean|string>=} opt_elements
* @return {!jspb.BinaryIterator}
*/
jspb.BinaryIterator.alloc = function(opt_decoder, opt_next, opt_elements) {
@@ -274,7 +274,7 @@ jspb.BinaryDecoder = function(opt_bytes, opt_start, opt_length) {
/**
* Global pool of BinaryDecoder instances.
- * @private {!Array.<!jspb.BinaryDecoder>}
+ * @private {!Array<!jspb.BinaryDecoder>}
*/
jspb.BinaryDecoder.instanceCache_ = [];
diff --git a/js/binary/encoder.js b/js/binary/encoder.js
index 8e9f5bbc..b2013f63 100644
--- a/js/binary/encoder.js
+++ b/js/binary/encoder.js
@@ -51,7 +51,7 @@ goog.require('jspb.utils');
* @struct
*/
jspb.BinaryEncoder = function() {
- /** @private {!Array.<number>} */
+ /** @private {!Array<number>} */
this.buffer_ = [];
};
@@ -65,7 +65,7 @@ jspb.BinaryEncoder.prototype.length = function() {
/**
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryEncoder.prototype.end = function() {
var buffer = this.buffer_;
diff --git a/js/binary/reader.js b/js/binary/reader.js
index d5d698f7..2dc3eb70 100644
--- a/js/binary/reader.js
+++ b/js/binary/reader.js
@@ -97,7 +97,7 @@ jspb.BinaryReader = function(opt_bytes, opt_start, opt_length) {
/**
* User-defined reader callbacks.
- * @private {Object.<string, function(!jspb.BinaryReader):*>}
+ * @private {Object<string, function(!jspb.BinaryReader):*>}
*/
this.readCallbacks_ = null;
};
@@ -105,7 +105,7 @@ jspb.BinaryReader = function(opt_bytes, opt_start, opt_length) {
/**
* Global pool of BinaryReader instances.
- * @private {!Array.<!jspb.BinaryReader>}
+ * @private {!Array<!jspb.BinaryReader>}
*/
jspb.BinaryReader.instanceCache_ = [];
@@ -992,7 +992,7 @@ jspb.BinaryReader.prototype.readPackedField_ = function(decodeMethod) {
/**
* Reads a packed int32 field, which consists of a length header and a list of
* signed varints.
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryReader.prototype.readPackedInt32 = function() {
return this.readPackedField_(this.decoder_.readSignedVarint32);
@@ -1002,7 +1002,7 @@ jspb.BinaryReader.prototype.readPackedInt32 = function() {
/**
* Reads a packed int32 field, which consists of a length header and a list of
* signed varints. Returns a list of strings.
- * @return {!Array.<string>}
+ * @return {!Array<string>}
*/
jspb.BinaryReader.prototype.readPackedInt32String = function() {
return this.readPackedField_(this.decoder_.readSignedVarint32String);
@@ -1012,7 +1012,7 @@ jspb.BinaryReader.prototype.readPackedInt32String = function() {
/**
* Reads a packed int64 field, which consists of a length header and a list of
* signed varints.
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryReader.prototype.readPackedInt64 = function() {
return this.readPackedField_(this.decoder_.readSignedVarint64);
@@ -1022,7 +1022,7 @@ jspb.BinaryReader.prototype.readPackedInt64 = function() {
/**
* Reads a packed int64 field, which consists of a length header and a list of
* signed varints. Returns a list of strings.
- * @return {!Array.<string>}
+ * @return {!Array<string>}
*/
jspb.BinaryReader.prototype.readPackedInt64String = function() {
return this.readPackedField_(this.decoder_.readSignedVarint64String);
@@ -1032,7 +1032,7 @@ jspb.BinaryReader.prototype.readPackedInt64String = function() {
/**
* Reads a packed uint32 field, which consists of a length header and a list of
* unsigned varints.
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryReader.prototype.readPackedUint32 = function() {
return this.readPackedField_(this.decoder_.readUnsignedVarint32);
@@ -1042,7 +1042,7 @@ jspb.BinaryReader.prototype.readPackedUint32 = function() {
/**
* Reads a packed uint32 field, which consists of a length header and a list of
* unsigned varints. Returns a list of strings.
- * @return {!Array.<string>}
+ * @return {!Array<string>}
*/
jspb.BinaryReader.prototype.readPackedUint32String = function() {
return this.readPackedField_(this.decoder_.readUnsignedVarint32String);
@@ -1052,7 +1052,7 @@ jspb.BinaryReader.prototype.readPackedUint32String = function() {
/**
* Reads a packed uint64 field, which consists of a length header and a list of
* unsigned varints.
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryReader.prototype.readPackedUint64 = function() {
return this.readPackedField_(this.decoder_.readUnsignedVarint64);
@@ -1062,7 +1062,7 @@ jspb.BinaryReader.prototype.readPackedUint64 = function() {
/**
* Reads a packed uint64 field, which consists of a length header and a list of
* unsigned varints. Returns a list of strings.
- * @return {!Array.<string>}
+ * @return {!Array<string>}
*/
jspb.BinaryReader.prototype.readPackedUint64String = function() {
return this.readPackedField_(this.decoder_.readUnsignedVarint64String);
@@ -1072,7 +1072,7 @@ jspb.BinaryReader.prototype.readPackedUint64String = function() {
/**
* Reads a packed sint32 field, which consists of a length header and a list of
* zigzag varints.
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryReader.prototype.readPackedSint32 = function() {
return this.readPackedField_(this.decoder_.readZigzagVarint32);
@@ -1082,7 +1082,7 @@ jspb.BinaryReader.prototype.readPackedSint32 = function() {
/**
* Reads a packed sint64 field, which consists of a length header and a list of
* zigzag varints.
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryReader.prototype.readPackedSint64 = function() {
return this.readPackedField_(this.decoder_.readZigzagVarint64);
@@ -1092,7 +1092,7 @@ jspb.BinaryReader.prototype.readPackedSint64 = function() {
/**
* Reads a packed sint64 field, which consists of a length header and a list of
* zigzag varints. Returns a list of strings.
- * @return {!Array.<string>}
+ * @return {!Array<string>}
*/
jspb.BinaryReader.prototype.readPackedSint64String = function() {
return this.readPackedField_(this.decoder_.readZigzagVarint64String);
@@ -1102,7 +1102,7 @@ jspb.BinaryReader.prototype.readPackedSint64String = function() {
/**
* Reads a packed fixed32 field, which consists of a length header and a list
* of unsigned 32-bit ints.
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryReader.prototype.readPackedFixed32 = function() {
return this.readPackedField_(this.decoder_.readUint32);
@@ -1112,7 +1112,7 @@ jspb.BinaryReader.prototype.readPackedFixed32 = function() {
/**
* Reads a packed fixed64 field, which consists of a length header and a list
* of unsigned 64-bit ints.
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryReader.prototype.readPackedFixed64 = function() {
return this.readPackedField_(this.decoder_.readUint64);
@@ -1122,7 +1122,7 @@ jspb.BinaryReader.prototype.readPackedFixed64 = function() {
/**
* Reads a packed fixed64 field, which consists of a length header and a list
* of unsigned 64-bit ints. Returns a list of strings.
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryReader.prototype.readPackedFixed64String = function() {
return this.readPackedField_(this.decoder_.readUint64String);
@@ -1132,7 +1132,7 @@ jspb.BinaryReader.prototype.readPackedFixed64String = function() {
/**
* Reads a packed sfixed32 field, which consists of a length header and a list
* of 32-bit ints.
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryReader.prototype.readPackedSfixed32 = function() {
return this.readPackedField_(this.decoder_.readInt32);
@@ -1142,7 +1142,7 @@ jspb.BinaryReader.prototype.readPackedSfixed32 = function() {
/**
* Reads a packed sfixed64 field, which consists of a length header and a list
* of 64-bit ints.
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryReader.prototype.readPackedSfixed64 = function() {
return this.readPackedField_(this.decoder_.readInt64);
@@ -1152,7 +1152,7 @@ jspb.BinaryReader.prototype.readPackedSfixed64 = function() {
/**
* Reads a packed sfixed64 field, which consists of a length header and a list
* of 64-bit ints. Returns a list of strings.
- * @return {!Array.<string>}
+ * @return {!Array<string>}
*/
jspb.BinaryReader.prototype.readPackedSfixed64String = function() {
return this.readPackedField_(this.decoder_.readInt64String);
@@ -1162,7 +1162,7 @@ jspb.BinaryReader.prototype.readPackedSfixed64String = function() {
/**
* Reads a packed float field, which consists of a length header and a list of
* floats.
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryReader.prototype.readPackedFloat = function() {
return this.readPackedField_(this.decoder_.readFloat);
@@ -1172,7 +1172,7 @@ jspb.BinaryReader.prototype.readPackedFloat = function() {
/**
* Reads a packed double field, which consists of a length header and a list of
* doubles.
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryReader.prototype.readPackedDouble = function() {
return this.readPackedField_(this.decoder_.readDouble);
@@ -1182,7 +1182,7 @@ jspb.BinaryReader.prototype.readPackedDouble = function() {
/**
* Reads a packed bool field, which consists of a length header and a list of
* unsigned varints.
- * @return {!Array.<boolean>}
+ * @return {!Array<boolean>}
*/
jspb.BinaryReader.prototype.readPackedBool = function() {
return this.readPackedField_(this.decoder_.readBool);
@@ -1192,7 +1192,7 @@ jspb.BinaryReader.prototype.readPackedBool = function() {
/**
* Reads a packed enum field, which consists of a length header and a list of
* unsigned varints.
- * @return {!Array.<number>}
+ * @return {!Array<number>}
*/
jspb.BinaryReader.prototype.readPackedEnum = function() {
return this.readPackedField_(this.decoder_.readEnum);
@@ -1202,7 +1202,7 @@ jspb.BinaryReader.prototype.readPackedEnum = function() {
/**
* Reads a packed varint hash64 field, which consists of a length header and a
* list of varint hash64s.
- * @return {!Array.<string>}
+ * @return {!Array<string>}
*/
jspb.BinaryReader.prototype.readPackedVarintHash64 = function() {
return this.readPackedField_(this.decoder_.readVarintHash64);
@@ -1212,7 +1212,7 @@ jspb.BinaryReader.prototype.readPackedVarintHash64 = function() {
/**
* Reads a packed fixed hash64 field, which consists of a length header and a
* list of fixed hash64s.
- * @return {!Array.<string>}
+ * @return {!Array<string>}
*/
jspb.BinaryReader.prototype.readPackedFixedHash64 = function() {
return this.readPackedField_(this.decoder_.readFixedHash64);
diff --git a/js/binary/utils.js b/js/binary/utils.js
index c706bff4..87570ff8 100644
--- a/js/binary/utils.js
+++ b/js/binary/utils.js
@@ -431,7 +431,7 @@ jspb.utils.joinHash64 = function(bitsLow, bitsHigh) {
/**
* Individual digits for number->string conversion.
- * @const {!Array.<string>}
+ * @const {!Array<string>}
*/
jspb.utils.DIGITS = [
'0', '1', '2', '3', '4', '5', '6', '7',
@@ -554,10 +554,10 @@ jspb.utils.hash64ToDecimalString = function(hash, signed) {
/**
* Converts an array of 8-character hash strings into their decimal
* representations.
- * @param {!Array.<string>} hashes The array of hash strings to convert.
+ * @param {!Array<string>} hashes The array of hash strings to convert.
* @param {boolean} signed True if we should treat the hash string as encoding
* a signed integer.
- * @return {!Array.<string>}
+ * @return {!Array<string>}
*/
jspb.utils.hash64ArrayToDecimalStrings = function(hashes, signed) {
var result = new Array(hashes.length);
@@ -972,7 +972,7 @@ jspb.utils.byteSourceToUint8Array = function(data) {
}
if (data.constructor === Array) {
- data = /** @type {!Array.<number>} */(data);
+ data = /** @type {!Array<number>} */(data);
return /** @type {!Uint8Array} */(new Uint8Array(data));
}
diff --git a/js/binary/utils_test.js b/js/binary/utils_test.js
index 6b481dce..13450644 100644
--- a/js/binary/utils_test.js
+++ b/js/binary/utils_test.js
@@ -657,7 +657,7 @@ describe('binaryUtilsTest', function() {
// Converting Uint8Arrays into Uint8Arrays should be a no-op.
assertEquals(sourceBytes, convert(sourceBytes));
- // Converting Array.<numbers> into Uint8Arrays should work.
+ // Converting Array<numbers> into Uint8Arrays should work.
check(convert(sourceData));
// Converting ArrayBuffers into Uint8Arrays should work.
diff --git a/js/binary/writer.js b/js/binary/writer.js
index 037e92b2..8a018058 100644
--- a/js/binary/writer.js
+++ b/js/binary/writer.js
@@ -102,7 +102,7 @@ jspb.BinaryWriter = function() {
* A stack of bookmarks containing the parent blocks for each message started
* via beginSubMessage(), needed as bookkeeping for endSubMessage().
* TODO(aappleby): Deprecated, users should be calling writeMessage().
- * @private {!Array.<!Array.<number>>}
+ * @private {!Array<!Array<number>>}
*/
this.bookmarks_ = [];
};
@@ -126,7 +126,7 @@ jspb.BinaryWriter.prototype.appendUint8Array_ = function(arr) {
* Begins a new message by writing the field header and returning a bookmark
* which we will use to patch in the message length to in endDelimited_ below.
* @param {number} field
- * @return {!Array.<number>}
+ * @return {!Array<number>}
* @private
*/
jspb.BinaryWriter.prototype.beginDelimited_ = function(field) {
@@ -143,7 +143,7 @@ jspb.BinaryWriter.prototype.beginDelimited_ = function(field) {
* Ends a message by encoding the _change_ in length of the buffer to the
* parent block and adds the number of bytes needed to encode that length to
* the total byte length.
- * @param {!Array.<number>} bookmark
+ * @param {!Array<number>} bookmark
* @private
*/
jspb.BinaryWriter.prototype.endDelimited_ = function(bookmark) {
@@ -855,7 +855,7 @@ jspb.BinaryWriter.prototype.writeVarintHash64 = function(field, value) {
/**
* Writes an array of numbers to the buffer as a repeated 32-bit int field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedInt32 = function(field, value) {
if (value == null) return;
@@ -869,7 +869,7 @@ jspb.BinaryWriter.prototype.writeRepeatedInt32 = function(field, value) {
* Writes an array of numbers formatted as strings to the buffer as a repeated
* 32-bit int field.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of ints to write.
+ * @param {?Array<string>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedInt32String = function(field, value) {
if (value == null) return;
@@ -882,7 +882,7 @@ jspb.BinaryWriter.prototype.writeRepeatedInt32String = function(field, value) {
/**
* Writes an array of numbers to the buffer as a repeated 64-bit int field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedInt64 = function(field, value) {
if (value == null) return;
@@ -896,7 +896,7 @@ jspb.BinaryWriter.prototype.writeRepeatedInt64 = function(field, value) {
* Writes an array of numbers formatted as strings to the buffer as a repeated
* 64-bit int field.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of ints to write.
+ * @param {?Array<string>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedInt64String = function(field, value) {
if (value == null) return;
@@ -910,7 +910,7 @@ jspb.BinaryWriter.prototype.writeRepeatedInt64String = function(field, value) {
* Writes an array numbers to the buffer as a repeated unsigned 32-bit int
* field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedUint32 = function(field, value) {
if (value == null) return;
@@ -924,7 +924,7 @@ jspb.BinaryWriter.prototype.writeRepeatedUint32 = function(field, value) {
* Writes an array of numbers formatted as strings to the buffer as a repeated
* unsigned 32-bit int field.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of ints to write.
+ * @param {?Array<string>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedUint32String = function(field, value) {
if (value == null) return;
@@ -938,7 +938,7 @@ jspb.BinaryWriter.prototype.writeRepeatedUint32String = function(field, value) {
* Writes an array numbers to the buffer as a repeated unsigned 64-bit int
* field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedUint64 = function(field, value) {
if (value == null) return;
@@ -952,7 +952,7 @@ jspb.BinaryWriter.prototype.writeRepeatedUint64 = function(field, value) {
* Writes an array of numbers formatted as strings to the buffer as a repeated
* unsigned 64-bit int field.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of ints to write.
+ * @param {?Array<string>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedUint64String = function(field, value) {
if (value == null) return;
@@ -965,7 +965,7 @@ jspb.BinaryWriter.prototype.writeRepeatedUint64String = function(field, value) {
/**
* Writes an array numbers to the buffer as a repeated signed 32-bit int field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedSint32 = function(field, value) {
if (value == null) return;
@@ -978,7 +978,7 @@ jspb.BinaryWriter.prototype.writeRepeatedSint32 = function(field, value) {
/**
* Writes an array numbers to the buffer as a repeated signed 64-bit int field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedSint64 = function(field, value) {
if (value == null) return;
@@ -991,7 +991,7 @@ jspb.BinaryWriter.prototype.writeRepeatedSint64 = function(field, value) {
/**
* Writes an array numbers to the buffer as a repeated signed 64-bit int field.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of ints to write.
+ * @param {?Array<string>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedSint64String = function(field, value) {
if (value == null) return;
@@ -1005,7 +1005,7 @@ jspb.BinaryWriter.prototype.writeRepeatedSint64String = function(field, value) {
* Writes an array of numbers to the buffer as a repeated fixed32 field. This
* works for both signed and unsigned fixed32s.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedFixed32 = function(field, value) {
if (value == null) return;
@@ -1019,7 +1019,7 @@ jspb.BinaryWriter.prototype.writeRepeatedFixed32 = function(field, value) {
* Writes an array of numbers to the buffer as a repeated fixed64 field. This
* works for both signed and unsigned fixed64s.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedFixed64 = function(field, value) {
if (value == null) return;
@@ -1033,7 +1033,7 @@ jspb.BinaryWriter.prototype.writeRepeatedFixed64 = function(field, value) {
* Writes an array of numbers to the buffer as a repeated fixed64 field. This
* works for both signed and unsigned fixed64s.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of decimal strings to write.
+ * @param {?Array<string>} value The array of decimal strings to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedFixed64String = function(
field, value) {
@@ -1047,7 +1047,7 @@ jspb.BinaryWriter.prototype.writeRepeatedFixed64String = function(
/**
* Writes an array of numbers to the buffer as a repeated sfixed32 field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedSfixed32 = function(field, value) {
if (value == null) return;
@@ -1060,7 +1060,7 @@ jspb.BinaryWriter.prototype.writeRepeatedSfixed32 = function(field, value) {
/**
* Writes an array of numbers to the buffer as a repeated sfixed64 field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedSfixed64 = function(field, value) {
if (value == null) return;
@@ -1074,7 +1074,7 @@ jspb.BinaryWriter.prototype.writeRepeatedSfixed64 = function(field, value) {
* Writes an array of decimal strings to the buffer as a repeated sfixed64
* field.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of decimal strings to write.
+ * @param {?Array<string>} value The array of decimal strings to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedSfixed64String = function(field, value) {
if (value == null) return;
@@ -1087,7 +1087,7 @@ jspb.BinaryWriter.prototype.writeRepeatedSfixed64String = function(field, value)
/**
* Writes an array of numbers to the buffer as a repeated float field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedFloat = function(field, value) {
if (value == null) return;
@@ -1100,7 +1100,7 @@ jspb.BinaryWriter.prototype.writeRepeatedFloat = function(field, value) {
/**
* Writes an array of numbers to the buffer as a repeated double field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedDouble = function(field, value) {
if (value == null) return;
@@ -1113,7 +1113,7 @@ jspb.BinaryWriter.prototype.writeRepeatedDouble = function(field, value) {
/**
* Writes an array of booleans to the buffer as a repeated bool field.
* @param {number} field The field number.
- * @param {?Array.<boolean>} value The array of ints to write.
+ * @param {?Array<boolean>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedBool = function(field, value) {
if (value == null) return;
@@ -1126,7 +1126,7 @@ jspb.BinaryWriter.prototype.writeRepeatedBool = function(field, value) {
/**
* Writes an array of enums to the buffer as a repeated enum field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedEnum = function(field, value) {
if (value == null) return;
@@ -1139,7 +1139,7 @@ jspb.BinaryWriter.prototype.writeRepeatedEnum = function(field, value) {
/**
* Writes an array of strings to the buffer as a repeated string field.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of strings to write.
+ * @param {?Array<string>} value The array of strings to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedString = function(field, value) {
if (value == null) return;
@@ -1152,7 +1152,7 @@ jspb.BinaryWriter.prototype.writeRepeatedString = function(field, value) {
/**
* Writes an array of arbitrary byte fields to the buffer.
* @param {number} field The field number.
- * @param {?Array.<!jspb.ByteSource>} value The arrays of arrays of bytes to
+ * @param {?Array<!jspb.ByteSource>} value The arrays of arrays of bytes to
* write.
*/
jspb.BinaryWriter.prototype.writeRepeatedBytes = function(field, value) {
@@ -1167,7 +1167,7 @@ jspb.BinaryWriter.prototype.writeRepeatedBytes = function(field, value) {
* Writes an array of messages to the buffer.
* @template MessageType
* @param {number} field The field number.
- * @param {?Array.<MessageType>} value The array of messages to
+ * @param {?Array<MessageType>} value The array of messages to
* write.
* @param {function(MessageType, !jspb.BinaryWriter)} writerCallback
* Will be invoked with the value to write and the writer to write it with.
@@ -1187,7 +1187,7 @@ jspb.BinaryWriter.prototype.writeRepeatedMessage = function(
* Writes an array of group messages to the buffer.
* @template MessageType
* @param {number} field The field number.
- * @param {?Array.<MessageType>} value The array of messages to
+ * @param {?Array<MessageType>} value The array of messages to
* write.
* @param {function(MessageType, !jspb.BinaryWriter)} writerCallback
* Will be invoked with the value to write and the writer to write it with.
@@ -1207,7 +1207,7 @@ jspb.BinaryWriter.prototype.writeRepeatedGroup = function(
* Writes a 64-bit hash string field (8 characters @ 8 bits of data each) to
* the buffer.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of hashes to write.
+ * @param {?Array<string>} value The array of hashes to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedFixedHash64 =
function(field, value) {
@@ -1222,7 +1222,7 @@ jspb.BinaryWriter.prototype.writeRepeatedFixedHash64 =
* Writes a repeated 64-bit hash string field (8 characters @ 8 bits of data
* each) to the buffer.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of hashes to write.
+ * @param {?Array<string>} value The array of hashes to write.
*/
jspb.BinaryWriter.prototype.writeRepeatedVarintHash64 =
function(field, value) {
@@ -1236,7 +1236,7 @@ jspb.BinaryWriter.prototype.writeRepeatedVarintHash64 =
/**
* Writes an array of numbers to the buffer as a packed 32-bit int field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writePackedInt32 = function(field, value) {
if (value == null || !value.length) return;
@@ -1252,7 +1252,7 @@ jspb.BinaryWriter.prototype.writePackedInt32 = function(field, value) {
* Writes an array of numbers represented as strings to the buffer as a packed
* 32-bit int field.
* @param {number} field
- * @param {?Array.<string>} value
+ * @param {?Array<string>} value
*/
jspb.BinaryWriter.prototype.writePackedInt32String = function(field, value) {
if (value == null || !value.length) return;
@@ -1267,7 +1267,7 @@ jspb.BinaryWriter.prototype.writePackedInt32String = function(field, value) {
/**
* Writes an array of numbers to the buffer as a packed 64-bit int field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writePackedInt64 = function(field, value) {
if (value == null || !value.length) return;
@@ -1283,7 +1283,7 @@ jspb.BinaryWriter.prototype.writePackedInt64 = function(field, value) {
* Writes an array of numbers represented as strings to the buffer as a packed
* 64-bit int field.
* @param {number} field
- * @param {?Array.<string>} value
+ * @param {?Array<string>} value
*/
jspb.BinaryWriter.prototype.writePackedInt64String = function(field, value) {
if (value == null || !value.length) return;
@@ -1299,7 +1299,7 @@ jspb.BinaryWriter.prototype.writePackedInt64String = function(field, value) {
/**
* Writes an array numbers to the buffer as a packed unsigned 32-bit int field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writePackedUint32 = function(field, value) {
if (value == null || !value.length) return;
@@ -1315,7 +1315,7 @@ jspb.BinaryWriter.prototype.writePackedUint32 = function(field, value) {
* Writes an array of numbers represented as strings to the buffer as a packed
* unsigned 32-bit int field.
* @param {number} field
- * @param {?Array.<string>} value
+ * @param {?Array<string>} value
*/
jspb.BinaryWriter.prototype.writePackedUint32String =
function(field, value) {
@@ -1331,7 +1331,7 @@ jspb.BinaryWriter.prototype.writePackedUint32String =
/**
* Writes an array numbers to the buffer as a packed unsigned 64-bit int field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writePackedUint64 = function(field, value) {
if (value == null || !value.length) return;
@@ -1347,7 +1347,7 @@ jspb.BinaryWriter.prototype.writePackedUint64 = function(field, value) {
* Writes an array of numbers represented as strings to the buffer as a packed
* unsigned 64-bit int field.
* @param {number} field
- * @param {?Array.<string>} value
+ * @param {?Array<string>} value
*/
jspb.BinaryWriter.prototype.writePackedUint64String =
function(field, value) {
@@ -1364,7 +1364,7 @@ jspb.BinaryWriter.prototype.writePackedUint64String =
/**
* Writes an array numbers to the buffer as a packed signed 32-bit int field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writePackedSint32 = function(field, value) {
if (value == null || !value.length) return;
@@ -1379,7 +1379,7 @@ jspb.BinaryWriter.prototype.writePackedSint32 = function(field, value) {
/**
* Writes an array of numbers to the buffer as a packed signed 64-bit int field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writePackedSint64 = function(field, value) {
if (value == null || !value.length) return;
@@ -1395,7 +1395,7 @@ jspb.BinaryWriter.prototype.writePackedSint64 = function(field, value) {
* Writes an array of decimal strings to the buffer as a packed signed 64-bit
* int field.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of decimal strings to write.
+ * @param {?Array<string>} value The array of decimal strings to write.
*/
jspb.BinaryWriter.prototype.writePackedSint64String = function(field, value) {
if (value == null || !value.length) return;
@@ -1411,7 +1411,7 @@ jspb.BinaryWriter.prototype.writePackedSint64String = function(field, value) {
/**
* Writes an array of numbers to the buffer as a packed fixed32 field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writePackedFixed32 = function(field, value) {
if (value == null || !value.length) return;
@@ -1426,7 +1426,7 @@ jspb.BinaryWriter.prototype.writePackedFixed32 = function(field, value) {
/**
* Writes an array of numbers to the buffer as a packed fixed64 field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writePackedFixed64 = function(field, value) {
if (value == null || !value.length) return;
@@ -1442,7 +1442,7 @@ jspb.BinaryWriter.prototype.writePackedFixed64 = function(field, value) {
* Writes an array of numbers represented as strings to the buffer as a packed
* fixed64 field.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of strings to write.
+ * @param {?Array<string>} value The array of strings to write.
*/
jspb.BinaryWriter.prototype.writePackedFixed64String = function(field, value) {
if (value == null || !value.length) return;
@@ -1458,7 +1458,7 @@ jspb.BinaryWriter.prototype.writePackedFixed64String = function(field, value) {
/**
* Writes an array of numbers to the buffer as a packed sfixed32 field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writePackedSfixed32 = function(field, value) {
if (value == null || !value.length) return;
@@ -1473,7 +1473,7 @@ jspb.BinaryWriter.prototype.writePackedSfixed32 = function(field, value) {
/**
* Writes an array of numbers to the buffer as a packed sfixed64 field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writePackedSfixed64 = function(field, value) {
if (value == null || !value.length) return;
@@ -1488,7 +1488,7 @@ jspb.BinaryWriter.prototype.writePackedSfixed64 = function(field, value) {
/**
* Writes an array of numbers to the buffer as a packed sfixed64 field.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of decimal strings to write.
+ * @param {?Array<string>} value The array of decimal strings to write.
*/
jspb.BinaryWriter.prototype.writePackedSfixed64String = function(field, value) {
if (value == null || !value.length) return;
@@ -1503,7 +1503,7 @@ jspb.BinaryWriter.prototype.writePackedSfixed64String = function(field, value) {
/**
* Writes an array of numbers to the buffer as a packed float field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writePackedFloat = function(field, value) {
if (value == null || !value.length) return;
@@ -1518,7 +1518,7 @@ jspb.BinaryWriter.prototype.writePackedFloat = function(field, value) {
/**
* Writes an array of numbers to the buffer as a packed double field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writePackedDouble = function(field, value) {
if (value == null || !value.length) return;
@@ -1533,7 +1533,7 @@ jspb.BinaryWriter.prototype.writePackedDouble = function(field, value) {
/**
* Writes an array of booleans to the buffer as a packed bool field.
* @param {number} field The field number.
- * @param {?Array.<boolean>} value The array of ints to write.
+ * @param {?Array<boolean>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writePackedBool = function(field, value) {
if (value == null || !value.length) return;
@@ -1548,7 +1548,7 @@ jspb.BinaryWriter.prototype.writePackedBool = function(field, value) {
/**
* Writes an array of enums to the buffer as a packed enum field.
* @param {number} field The field number.
- * @param {?Array.<number>} value The array of ints to write.
+ * @param {?Array<number>} value The array of ints to write.
*/
jspb.BinaryWriter.prototype.writePackedEnum = function(field, value) {
if (value == null || !value.length) return;
@@ -1564,7 +1564,7 @@ jspb.BinaryWriter.prototype.writePackedEnum = function(field, value) {
* Writes a 64-bit hash string field (8 characters @ 8 bits of data each) to
* the buffer.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of hashes to write.
+ * @param {?Array<string>} value The array of hashes to write.
*/
jspb.BinaryWriter.prototype.writePackedFixedHash64 = function(field, value) {
if (value == null || !value.length) return;
@@ -1580,7 +1580,7 @@ jspb.BinaryWriter.prototype.writePackedFixedHash64 = function(field, value) {
* Writes a 64-bit hash string field (8 characters @ 8 bits of data each) to
* the buffer.
* @param {number} field The field number.
- * @param {?Array.<string>} value The array of hashes to write.
+ * @param {?Array<string>} value The array of hashes to write.
*/
jspb.BinaryWriter.prototype.writePackedVarintHash64 = function(field, value) {
if (value == null || !value.length) return;
diff --git a/js/commonjs/export_testdeps.js b/js/commonjs/export_testdeps.js
index 6f5cd083..96d3f347 100644
--- a/js/commonjs/export_testdeps.js
+++ b/js/commonjs/export_testdeps.js
@@ -12,6 +12,7 @@
goog.provide('jspb.ExportTestDeps');
goog.require('goog.crypt.base64');
+goog.require('goog.testing.PropertyReplacer');
goog.require('jspb.arith.Int64');
goog.require('jspb.arith.UInt64');
goog.require('jspb.BinaryEncoder');
diff --git a/js/debug.js b/js/debug.js
index 46b24853..4ae3c2a2 100644
--- a/js/debug.js
+++ b/js/debug.js
@@ -74,15 +74,22 @@ jspb.debug.dump = function(message) {
*/
jspb.debug.dump_ = function(thing) {
var type = goog.typeOf(thing);
+ var message = thing; // Copy because we don't want type inference on thing.
if (type == 'number' || type == 'string' || type == 'boolean' ||
type == 'null' || type == 'undefined') {
return thing;
}
+ if (typeof Uint8Array !== 'undefined') {
+ // Will fail on IE9, where Uint8Array doesn't exist.
+ if (message instanceof Uint8Array) {
+ return thing;
+ }
+ }
+
if (type == 'array') {
goog.asserts.assertArray(thing);
return goog.array.map(thing, jspb.debug.dump_);
}
- var message = thing; // Copy because we don't want type inference on thing.
goog.asserts.assert(message instanceof jspb.Message,
'Only messages expected: ' + thing);
var ctor = message.constructor;
diff --git a/js/debug_test.js b/js/debug_test.js
index 702cc76e..d0d646a5 100644
--- a/js/debug_test.js
+++ b/js/debug_test.js
@@ -41,6 +41,8 @@ goog.require('proto.jspb.test.IsExtension');
goog.require('proto.jspb.test.Simple1');
+// CommonJS-LoadFromFile: testbinary_pb
+goog.require('proto.jspb.test.TestAllTypes');
describe('debugTest', function() {
it('testSimple1', function() {
@@ -74,6 +76,15 @@ describe('debugTest', function() {
}, jspb.debug.dump(message));
});
+ it('testBytes', function() {
+ if (COMPILED || typeof Uint8Array == 'undefined') {
+ return;
+ }
+ var message = new proto.jspb.test.TestAllTypes();
+ var bytes = new Uint8Array(4);
+ message.setOptionalBytes(bytes);
+ assertEquals(jspb.debug.dump(message)['optionalBytes'], bytes);
+ });
it('testExtensions', function() {
if (COMPILED) {
diff --git a/js/message.js b/js/message.js
index 1484229d..8f68cbb4 100644
--- a/js/message.js
+++ b/js/message.js
@@ -205,6 +205,16 @@ goog.define('jspb.Message.GENERATE_TO_STRING', true);
goog.define('jspb.Message.ASSUME_LOCAL_ARRAYS', false);
+// TODO(jakubvrana): Turn this off by default.
+/**
+ * @define {boolean} Disabling the serialization of empty trailing fields
+ * reduces the size of serialized protos. The price is an extra iteration of
+ * the proto before serialization. This is enabled by default to be
+ * backwards compatible. Projects are advised to turn this flag always off.
+ */
+goog.define('jspb.Message.SERIALIZE_EMPTY_TRAILING_FIELDS', true);
+
+
/**
* @define {boolean} Turning on this flag does NOT change the behavior of JSPB
* and only affects private internal state. It may, however, break some
@@ -212,8 +222,8 @@ goog.define('jspb.Message.ASSUME_LOCAL_ARRAYS', false);
* mutates its internal state.
* Projects are advised to turn this flag always on.
*/
-goog.define('jspb.Message.MINIMIZE_MEMORY_ALLOCATIONS', COMPILED);
-// TODO(b/19419436) Turn this on by default.
+goog.define('jspb.Message.MINIMIZE_MEMORY_ALLOCATIONS', true);
+// TODO(b/19419436): Delete this flag.
/**
@@ -278,6 +288,13 @@ jspb.Message.prototype.convertedFloatingPointFields_;
/**
+ * Repeated fields numbers.
+ * @protected {?Array<number>|undefined}
+ */
+jspb.Message.prototype.repeatedFields;
+
+
+/**
* The xid of this proto type (The same for all instances of a proto). Provides
* a way to identify a proto by stable obfuscated name.
* @see {xid}.
@@ -324,6 +341,18 @@ jspb.Message.getIndex_ = function(msg, fieldNumber) {
/**
+ * Returns the tag number based on the index in msg.array.
+ * @param {!jspb.Message} msg Message for which we're calculating an index.
+ * @param {number} index The tag number.
+ * @return {number} The field number.
+ * @private
+ */
+jspb.Message.getFieldNumber_ = function(msg, index) {
+ return index - msg.arrayIndexOffset_;
+};
+
+
+/**
* Initializes a JsPb Message.
* @param {!jspb.Message} msg The JsPb proto to modify.
* @param {Array|undefined} data An initial data array.
@@ -353,6 +382,13 @@ jspb.Message.initialize = function(
jspb.Message.initPivotAndExtensionObject_(msg, suggestedPivot);
msg.convertedFloatingPointFields_ = {};
+ if (!jspb.Message.SERIALIZE_EMPTY_TRAILING_FIELDS) {
+ // TODO(jakubvrana): This is same for all instances, move to prototype.
+ // TODO(jakubvrana): There are indexOf calls on this in serializtion,
+ // consider switching to a set.
+ msg.repeatedFields = repeatedFields;
+ }
+
if (repeatedFields) {
for (var i = 0; i < repeatedFields.length; i++) {
var fieldNumber = repeatedFields[i];
@@ -376,8 +412,9 @@ jspb.Message.initialize = function(
if (opt_oneofFields && opt_oneofFields.length) {
// Compute the oneof case for each union. This ensures only one value is
// set in the union.
- goog.array.forEach(
- opt_oneofFields, goog.partial(jspb.Message.computeOneofCase, msg));
+ for (var i = 0; i < opt_oneofFields.length; i++) {
+ jspb.Message.computeOneofCase(msg, opt_oneofFields[i]);
+ }
}
};
@@ -428,7 +465,7 @@ jspb.Message.initPivotAndExtensionObject_ = function(msg, suggestedPivot) {
// in Safari on iOS 8. See the description of CL/86511464 for details.
if (obj && typeof obj == 'object' && !jspb.Message.isArray_(obj) &&
!(jspb.Message.SUPPORTS_UINT8ARRAY_ && obj instanceof Uint8Array)) {
- msg.pivot_ = foundIndex - msg.arrayIndexOffset_;
+ msg.pivot_ = jspb.Message.getFieldNumber_(msg, foundIndex);
msg.extensionObject_ = obj;
return;
}
@@ -1043,14 +1080,15 @@ jspb.Message.computeOneofCase = function(msg, oneof) {
var oneofField;
var oneofValue;
- goog.array.forEach(oneof, function(fieldNumber) {
+ for (var i = 0; i < oneof.length; i++) {
+ var fieldNumber = oneof[i];
var value = jspb.Message.getField(msg, fieldNumber);
- if (goog.isDefAndNotNull(value)) {
+ if (value != null) {
oneofField = fieldNumber;
oneofValue = value;
jspb.Message.setField(msg, fieldNumber, undefined);
}
- });
+ }
if (oneofField) {
// NB: We know the value is unique, so we can call jspb.Message.setField
@@ -1241,7 +1279,7 @@ jspb.Message.addToRepeatedWrapperField = function(
* dead code removal.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
- * @return {!Object.<string, Object>} A map of proto or Soy objects.
+ * @return {!Object<string, Object>} A map of proto or Soy objects.
* @template T
*/
jspb.Message.toMap = function(
@@ -1318,7 +1356,7 @@ jspb.Message.prototype.toString = function() {
/**
* Gets the value of the extension field from the extended object.
- * @param {jspb.ExtensionFieldInfo.<T>} fieldInfo Specifies the field to get.
+ * @param {jspb.ExtensionFieldInfo<T>} fieldInfo Specifies the field to get.
* @return {T} The value of the field.
* @template T
*/
@@ -1705,7 +1743,11 @@ jspb.Message.registry_ = {};
* non-MessageSet. We special case MessageSet so that we do not need
* to goog.require MessageSet from classes that extends MessageSet.
*
- * @type {!Object.<number, jspb.ExtensionFieldInfo>}
+ * @type {!Object<number, jspb.ExtensionFieldInfo>}
*/
jspb.Message.messageSetExtensions = {};
+
+/**
+ * @type {!Object<number, jspb.ExtensionFieldBinaryInfo>}
+ */
jspb.Message.messageSetExtensionsBinary = {};
diff --git a/js/message_test.js b/js/message_test.js
index 7d61dacb..0acebb75 100644
--- a/js/message_test.js
+++ b/js/message_test.js
@@ -34,6 +34,7 @@ goog.setTestOnly();
goog.require('goog.json');
goog.require('goog.string');
+goog.require('goog.testing.PropertyReplacer');
goog.require('goog.testing.asserts');
goog.require('goog.userAgent');
@@ -85,6 +86,16 @@ goog.require('proto.jspb.test.TestExtensionsMessage');
describe('Message test suite', function() {
+ var stubs = new goog.testing.PropertyReplacer();
+
+ beforeEach(function() {
+ stubs.set(jspb.Message, 'SERIALIZE_EMPTY_TRAILING_FIELDS', false);
+ });
+
+ afterEach(function() {
+ stubs.reset();
+ });
+
it('testEmptyProto', function() {
var empty1 = new proto.jspb.test.Empty([]);
var empty2 = new proto.jspb.test.Empty([]);
diff --git a/kokoro/linux/32-bit/Dockerfile b/kokoro/linux/32-bit/Dockerfile
new file mode 100644
index 00000000..1278889f
--- /dev/null
+++ b/kokoro/linux/32-bit/Dockerfile
@@ -0,0 +1,143 @@
+# This Dockerfile specifies the recipe for creating an image for the tests
+# to run in.
+#
+# We install as many test dependencies here as we can, because these setup
+# steps can be cached. They do *not* run every time we run the build.
+# The Docker image is only rebuilt when the Dockerfile (ie. this file)
+# changes.
+
+# Base Dockerfile for gRPC dev images
+FROM 32bit/debian:latest
+
+# Apt source for php
+RUN echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu trusty main" | tee /etc/apt/sources.list.d/various-php.list && \
+ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F4FCBB07
+
+# Install dependencies. We start with the basic ones require to build protoc
+# and the C++ build
+RUN apt-get clean && apt-get update && apt-get install -y --force-yes \
+ autoconf \
+ autotools-dev \
+ build-essential \
+ bzip2 \
+ ccache \
+ curl \
+ gcc \
+ git \
+ libc6 \
+ libc6-dbg \
+ libc6-dev \
+ libgtest-dev \
+ libtool \
+ make \
+ parallel \
+ time \
+ wget \
+ unzip \
+ # -- For python --
+ python-setuptools \
+ python-pip \
+ python-dev \
+ # -- For C++ benchmarks --
+ cmake \
+ # -- For PHP --
+ php5.5 \
+ php5.5-dev \
+ php5.5-xml \
+ php5.6 \
+ php5.6-dev \
+ php5.6-xml \
+ php7.0 \
+ php7.0-dev \
+ php7.0-xml \
+ phpunit \
+ valgrind \
+ libxml2-dev \
+ && apt-get clean
+
+##################
+# PHP dependencies.
+RUN wget http://am1.php.net/get/php-5.5.38.tar.bz2/from/this/mirror
+RUN mv mirror php-5.5.38.tar.bz2
+RUN tar -xvf php-5.5.38.tar.bz2
+RUN cd php-5.5.38 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.5-zts && \
+ make && make install && make clean && cd ..
+RUN cd php-5.5.38 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.5 && \
+ make && make install && make clean && cd ..
+
+RUN wget http://am1.php.net/get/php-5.6.30.tar.bz2/from/this/mirror
+RUN mv mirror php-5.6.30.tar.bz2
+RUN tar -xvf php-5.6.30.tar.bz2
+RUN cd php-5.6.30 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.6-zts && \
+ make && make install && cd ..
+RUN cd php-5.6.30 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.6 && \
+ make && make install && cd ..
+
+RUN wget http://am1.php.net/get/php-7.0.18.tar.bz2/from/this/mirror
+RUN mv mirror php-7.0.18.tar.bz2
+RUN tar -xvf php-7.0.18.tar.bz2
+RUN cd php-7.0.18 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.0-zts && \
+ make && make install && cd ..
+RUN cd php-7.0.18 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.0 && \
+ make && make install && cd ..
+
+RUN wget http://am1.php.net/get/php-7.1.4.tar.bz2/from/this/mirror
+RUN mv mirror php-7.1.4.tar.bz2
+RUN tar -xvf php-7.1.4.tar.bz2
+RUN cd php-7.1.4 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.1-zts && \
+ make && make install && cd ..
+RUN cd php-7.1.4 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.1 && \
+ make && make install && cd ..
+
+RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
+RUN php composer-setup.php
+RUN mv composer.phar /usr/bin/composer
+RUN php -r "unlink('composer-setup.php');"
+RUN composer config -g -- disable-tls true
+RUN composer config -g -- secure-http false
+RUN cd /tmp && \
+ git clone https://github.com/google/protobuf.git && \
+ cd protobuf/php && \
+ git reset --hard 49b44bff2b6257a119f9c6a342d6151c736586b8 && \
+ ln -sfn /usr/local/php-5.5/bin/php /usr/bin/php && \
+ ln -sfn /usr/local/php-5.5/bin/php-config /usr/bin/php-config && \
+ ln -sfn /usr/local/php-5.5/bin/phpize /usr/bin/phpize && \
+ composer install && \
+ mv vendor /usr/local/vendor-5.5 && \
+ ln -sfn /usr/local/php-5.6/bin/php /usr/bin/php && \
+ ln -sfn /usr/local/php-5.6/bin/php-config /usr/bin/php-config && \
+ ln -sfn /usr/local/php-5.6/bin/phpize /usr/bin/phpize && \
+ composer install && \
+ mv vendor /usr/local/vendor-5.6 && \
+ ln -sfn /usr/local/php-7.0/bin/php /usr/bin/php && \
+ ln -sfn /usr/local/php-7.0/bin/php-config /usr/bin/php-config && \
+ ln -sfn /usr/local/php-7.0/bin/phpize /usr/bin/phpize && \
+ composer install && \
+ mv vendor /usr/local/vendor-7.0 && \
+ ln -sfn /usr/local/php-7.1/bin/php /usr/bin/php && \
+ ln -sfn /usr/local/php-7.1/bin/php-config /usr/bin/php-config && \
+ ln -sfn /usr/local/php-7.1/bin/phpize /usr/bin/phpize && \
+ composer install && \
+ mv vendor /usr/local/vendor-7.1
+
+##################
+# Python dependencies
+
+# These packages exist in apt-get, but their versions are too old, so we have
+# to get updates from pip.
+
+RUN pip install pip --upgrade
+RUN pip install virtualenv tox yattag
+
+##################
+# Prepare ccache
+
+RUN ln -s /usr/bin/ccache /usr/local/bin/gcc
+RUN ln -s /usr/bin/ccache /usr/local/bin/g++
+RUN ln -s /usr/bin/ccache /usr/local/bin/cc
+RUN ln -s /usr/bin/ccache /usr/local/bin/c++
+RUN ln -s /usr/bin/ccache /usr/local/bin/clang
+RUN ln -s /usr/bin/ccache /usr/local/bin/clang++
+
+# Define the default command.
+CMD ["bash"]
diff --git a/kokoro/linux/32-bit/build.sh b/kokoro/linux/32-bit/build.sh
new file mode 100755
index 00000000..04383a57
--- /dev/null
+++ b/kokoro/linux/32-bit/build.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "pull request 32" project:
+#
+# This script selects a specific Dockerfile (for building a Docker image) and
+# a script to run inside that image. Then we delegate to the general
+# build_and_run_docker.sh script.
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+export DOCKERFILE_DIR=kokoro/linux/32-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="php_all_32"
+./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/32-bit/continuous.cfg b/kokoro/linux/32-bit/continuous.cfg
new file mode 100644
index 00000000..28b66c07
--- /dev/null
+++ b/kokoro/linux/32-bit/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/32-bit/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/32-bit/presubmit.cfg b/kokoro/linux/32-bit/presubmit.cfg
new file mode 100644
index 00000000..28b66c07
--- /dev/null
+++ b/kokoro/linux/32-bit/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/32-bit/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/64-bit/Dockerfile b/kokoro/linux/64-bit/Dockerfile
new file mode 100644
index 00000000..3a279e66
--- /dev/null
+++ b/kokoro/linux/64-bit/Dockerfile
@@ -0,0 +1,244 @@
+# This Dockerfile specifies the recipe for creating an image for the tests
+# to run in.
+#
+# We install as many test dependencies here as we can, because these setup
+# steps can be cached. They do *not* run every time we run the build.
+# The Docker image is only rebuilt when the Dockerfile (ie. this file)
+# changes.
+
+# Base Dockerfile for gRPC dev images
+FROM debian:latest
+
+# Apt source for old Python versions.
+RUN echo 'deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu trusty main' > /etc/apt/sources.list.d/deadsnakes.list && \
+ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB82666C
+
+# Apt source for Oracle Java.
+RUN echo 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' > /etc/apt/sources.list.d/webupd8team-java-trusty.list && \
+ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \
+ echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
+
+# Apt source for Mono
+RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list && \
+ echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list && \
+ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
+
+# Apt source for php
+RUN echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu trusty main" | tee /etc/apt/sources.list.d/various-php.list && \
+ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F4FCBB07
+
+# Install dotnet SDK based on https://www.microsoft.com/net/core#debian
+# (Ubuntu instructions need apt to support https)
+RUN apt-get update && apt-get install -y --force-yes curl libunwind8 gettext && \
+ curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=847105 && \
+ mkdir -p /opt/dotnet && tar zxf dotnet.tar.gz -C /opt/dotnet && \
+ ln -s /opt/dotnet/dotnet /usr/local/bin
+
+# Install dependencies. We start with the basic ones require to build protoc
+# and the C++ build
+RUN apt-get clean && apt-get update && apt-get install -y --force-yes \
+ autoconf \
+ autotools-dev \
+ build-essential \
+ bzip2 \
+ ccache \
+ curl \
+ gcc \
+ git \
+ libc6 \
+ libc6-dbg \
+ libc6-dev \
+ libgtest-dev \
+ libtool \
+ make \
+ parallel \
+ time \
+ wget \
+ # -- For csharp --
+ mono-devel \
+ referenceassemblies-pcl \
+ nunit \
+ # -- For all Java builds -- \
+ maven \
+ # -- For java_jdk6 -- \
+ # oops! not in jessie. too old? openjdk-6-jdk \
+ # -- For java_jdk7 -- \
+ openjdk-7-jdk \
+ # -- For java_oracle7 -- \
+ oracle-java7-installer \
+ # -- For python / python_cpp -- \
+ python-setuptools \
+ python-pip \
+ python-dev \
+ python2.6-dev \
+ python3.3-dev \
+ python3.4-dev \
+ # -- For Ruby --
+ ruby \
+ # -- For C++ benchmarks --
+ cmake \
+ # -- For PHP --
+ php5.6 \
+ php5.6-dev \
+ php5.6-xml \
+ php7.0 \
+ php7.0-dev \
+ php7.0-xml \
+ phpunit \
+ valgrind \
+ libxml2-dev \
+ && apt-get clean
+
+##################
+# C# dependencies
+
+RUN wget www.nuget.org/NuGet.exe -O /usr/local/bin/nuget.exe
+
+##################
+# Python dependencies
+
+# These packages exist in apt-get, but their versions are too old, so we have
+# to get updates from pip.
+
+RUN pip install pip --upgrade
+RUN pip install virtualenv tox yattag
+
+##################
+# Ruby dependencies
+
+# Install rvm
+RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
+RUN \curl -sSL https://get.rvm.io | bash -s stable
+
+# Install Ruby 2.1, Ruby 2.2 and JRuby 1.7
+RUN /bin/bash -l -c "rvm install ruby-2.1"
+RUN /bin/bash -l -c "rvm install ruby-2.2"
+RUN /bin/bash -l -c "rvm install jruby-1.7"
+RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
+RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
+RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"
+
+##################
+# Java dependencies
+
+# This step requires compiling protoc. :(
+
+ENV MAVEN_REPO /var/maven_local_repository
+ENV MVN mvn --batch-mode
+
+RUN cd /tmp && \
+ git clone https://github.com/google/protobuf.git && \
+ cd protobuf && \
+ git reset --hard 129a6e2aca95dcfb6c3e717d7b9cca1f104fde39 && \
+ ./autogen.sh && \
+ ./configure && \
+ make -j4 && \
+ cd java && \
+ $MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO && \
+ cd ../javanano && \
+ $MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO
+
+##################
+# PHP dependencies.
+RUN wget http://am1.php.net/get/php-5.5.38.tar.bz2/from/this/mirror
+RUN mv mirror php-5.5.38.tar.bz2
+RUN tar -xvf php-5.5.38.tar.bz2
+RUN cd php-5.5.38 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.5-zts && \
+ make && make install && cd ..
+RUN cd php-5.5.38 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.5 && \
+ make && make install && cd ..
+
+RUN wget http://am1.php.net/get/php-5.6.30.tar.bz2/from/this/mirror
+RUN mv mirror php-5.6.30.tar.bz2
+RUN tar -xvf php-5.6.30.tar.bz2
+RUN cd php-5.6.30 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.6-zts && \
+ make && make install && cd ..
+RUN cd php-5.6.30 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.6 && \
+ make && make install && cd ..
+
+RUN wget http://am1.php.net/get/php-7.0.18.tar.bz2/from/this/mirror
+RUN mv mirror php-7.0.18.tar.bz2
+RUN tar -xvf php-7.0.18.tar.bz2
+RUN cd php-7.0.18 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.0-zts && \
+ make && make install && cd ..
+RUN cd php-7.0.18 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.0 && \
+ make && make install && cd ..
+
+RUN wget http://am1.php.net/get/php-7.1.4.tar.bz2/from/this/mirror
+RUN mv mirror php-7.1.4.tar.bz2
+RUN tar -xvf php-7.1.4.tar.bz2
+RUN cd php-7.1.4 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.1-zts && \
+ make && make install && cd ..
+RUN cd php-7.1.4 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.1 && \
+ make && make install && cd ..
+
+RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
+RUN php composer-setup.php
+RUN mv composer.phar /usr/bin/composer
+RUN php -r "unlink('composer-setup.php');"
+RUN composer config -g -- disable-tls true
+RUN composer config -g -- secure-http false
+RUN cd /tmp && \
+ rm -rf protobuf && \
+ git clone https://github.com/google/protobuf.git && \
+ cd protobuf && \
+ git reset --hard 49b44bff2b6257a119f9c6a342d6151c736586b8 && \
+ cd php && \
+ ln -sfn /usr/local/php-5.5/bin/php /usr/bin/php && \
+ ln -sfn /usr/local/php-5.5/bin/php-config /usr/bin/php-config && \
+ ln -sfn /usr/local/php-5.5/bin/phpize /usr/bin/phpize && \
+ composer install && \
+ mv vendor /usr/local/vendor-5.5 && \
+ ln -sfn /usr/local/php-5.6/bin/php /usr/bin/php && \
+ ln -sfn /usr/local/php-5.6/bin/php-config /usr/bin/php-config && \
+ ln -sfn /usr/local/php-5.6/bin/phpize /usr/bin/phpize && \
+ composer install && \
+ mv vendor /usr/local/vendor-5.6 && \
+ ln -sfn /usr/local/php-7.0/bin/php /usr/bin/php && \
+ ln -sfn /usr/local/php-7.0/bin/php-config /usr/bin/php-config && \
+ ln -sfn /usr/local/php-7.0/bin/phpize /usr/bin/phpize && \
+ composer install && \
+ mv vendor /usr/local/vendor-7.0 && \
+ ln -sfn /usr/local/php-7.1/bin/php /usr/bin/php && \
+ ln -sfn /usr/local/php-7.1/bin/php-config /usr/bin/php-config && \
+ ln -sfn /usr/local/php-7.1/bin/phpize /usr/bin/phpize && \
+ composer install && \
+ mv vendor /usr/local/vendor-7.1
+
+##################
+# Go dependencies.
+RUN apt-get install -y \
+ # -- For go -- \
+ golang
+
+##################
+# Javascript dependencies.
+RUN apt-get install -y \
+ # -- For javascript -- \
+ npm
+
+##################
+# Python 3.5 3.6 dependencies.
+RUN apt-get clean && apt-get update && apt-get install -y --force-yes \
+ python3.5-dev \
+ python3.6-dev \
+ && apt-get clean
+
+# On Debian/Ubuntu, nodejs binary is named 'nodejs' because the name 'node'
+# is taken by another legacy binary. We don't have that legacy binary and
+# npm expects the binary to be named 'node', so we just create a symbol
+# link here.
+RUN ln -s `which nodejs` /usr/bin/node
+
+##################
+# Prepare ccache
+
+RUN ln -s /usr/bin/ccache /usr/local/bin/gcc
+RUN ln -s /usr/bin/ccache /usr/local/bin/g++
+RUN ln -s /usr/bin/ccache /usr/local/bin/cc
+RUN ln -s /usr/bin/ccache /usr/local/bin/c++
+RUN ln -s /usr/bin/ccache /usr/local/bin/clang
+RUN ln -s /usr/bin/ccache /usr/local/bin/clang++
+
+# Define the default command.
+CMD ["bash"]
diff --git a/kokoro/linux/64-bit/build.sh b/kokoro/linux/64-bit/build.sh
new file mode 100755
index 00000000..48ddbce5
--- /dev/null
+++ b/kokoro/linux/64-bit/build.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "pull request" project:
+#
+# This script selects a specific Dockerfile (for building a Docker image) and
+# a script to run inside that image. Then we delegate to the general
+# build_and_run_docker.sh script.
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+export DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="csharp java_jdk7 javanano_jdk7 java_oracle7 javanano_oracle7 python python_cpp ruby_all javascript golang php_all"
+./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/64-bit/continuous.cfg b/kokoro/linux/64-bit/continuous.cfg
new file mode 100644
index 00000000..3a4faac1
--- /dev/null
+++ b/kokoro/linux/64-bit/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/64-bit/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/64-bit/presubmit.cfg b/kokoro/linux/64-bit/presubmit.cfg
new file mode 100644
index 00000000..3a4faac1
--- /dev/null
+++ b/kokoro/linux/64-bit/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/64-bit/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/build_and_run_docker.sh b/kokoro/linux/build_and_run_docker.sh
new file mode 100755
index 00000000..6a1f327a
--- /dev/null
+++ b/kokoro/linux/build_and_run_docker.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+#
+# Builds docker image and runs a command under it.
+# This is a generic script that is configured with the following variables:
+#
+# DOCKERFILE_DIR - Directory in which Dockerfile file is located.
+# DOCKER_RUN_SCRIPT - Script to run under docker (relative to protobuf repo root)
+# OUTPUT_DIR - Directory that will be copied from inside docker after finishing.
+# $@ - Extra args to pass to docker run
+
+
+set -ex
+
+cd $(dirname $0)/../..
+git_root=$(pwd)
+cd -
+
+# Use image name based on Dockerfile sha1
+DOCKERHUB_ORGANIZATION=grpctesting/protobuf
+DOCKER_IMAGE_NAME=${DOCKERHUB_ORGANIZATION}_$(sha1sum $DOCKERFILE_DIR/Dockerfile | cut -f1 -d\ )
+
+# Pull dockerimage from Dockerhub
+docker pull $DOCKER_IMAGE_NAME
+
+# Ensure existence of ccache directory
+CCACHE_DIR=/tmp/protobuf-ccache
+mkdir -p $CCACHE_DIR
+
+# Choose random name for docker container
+CONTAINER_NAME="build_and_run_docker_$(uuidgen)"
+
+echo $git_root
+
+# Run command inside docker
+docker run \
+ "$@" \
+ -e CCACHE_DIR=$CCACHE_DIR \
+ -e EXTERNAL_GIT_ROOT="/var/local/kokoro/protobuf" \
+ -e TEST_SET="$TEST_SET" \
+ -e THIS_IS_REALLY_NEEDED='see https://github.com/docker/docker/issues/14203 for why docker is awful' \
+ -v "$git_root:/var/local/kokoro/protobuf:ro" \
+ -v $CCACHE_DIR:$CCACHE_DIR \
+ -w /var/local/git/protobuf \
+ --name=$CONTAINER_NAME \
+ $DOCKER_IMAGE_NAME \
+ bash -l "/var/local/kokoro/protobuf/$DOCKER_RUN_SCRIPT" || FAILED="true"
+
+# Copy output artifacts
+if [ "$OUTPUT_DIR" != "" ]
+then
+ docker cp "$CONTAINER_NAME:/var/local/git/protobuf/$OUTPUT_DIR" "${git_root}/kokoro" || FAILED="true"
+fi
+
+# remove the container, possibly killing it first
+docker rm -f $CONTAINER_NAME || true
+
+if [ "$FAILED" != "" ]
+then
+ exit 1
+fi
diff --git a/kokoro/linux/golang/build.sh b/kokoro/linux/golang/build.sh
new file mode 100755
index 00000000..79cddff1
--- /dev/null
+++ b/kokoro/linux/golang/build.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "pull request" project:
+#
+# This script selects a specific Dockerfile (for building a Docker image) and
+# a script to run inside that image. Then we delegate to the general
+# build_and_run_docker.sh script.
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+export DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="golang"
+./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/golang/continuous.cfg b/kokoro/linux/golang/continuous.cfg
new file mode 100644
index 00000000..2282f78f
--- /dev/null
+++ b/kokoro/linux/golang/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/golang/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/golang/presubmit.cfg b/kokoro/linux/golang/presubmit.cfg
new file mode 100644
index 00000000..2282f78f
--- /dev/null
+++ b/kokoro/linux/golang/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/golang/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/java_jdk7/build.sh b/kokoro/linux/java_jdk7/build.sh
new file mode 100755
index 00000000..0a5604b4
--- /dev/null
+++ b/kokoro/linux/java_jdk7/build.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "pull request" project:
+#
+# This script selects a specific Dockerfile (for building a Docker image) and
+# a script to run inside that image. Then we delegate to the general
+# build_and_run_docker.sh script.
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+export DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="java_jdk7"
+./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/java_jdk7/continuous.cfg b/kokoro/linux/java_jdk7/continuous.cfg
new file mode 100644
index 00000000..07a9df5f
--- /dev/null
+++ b/kokoro/linux/java_jdk7/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/java_jdk7/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/java_jdk7/presubmit.cfg b/kokoro/linux/java_jdk7/presubmit.cfg
new file mode 100644
index 00000000..07a9df5f
--- /dev/null
+++ b/kokoro/linux/java_jdk7/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/java_jdk7/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/java_oracle7/build.sh b/kokoro/linux/java_oracle7/build.sh
new file mode 100755
index 00000000..9ab90dad
--- /dev/null
+++ b/kokoro/linux/java_oracle7/build.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "pull request" project:
+#
+# This script selects a specific Dockerfile (for building a Docker image) and
+# a script to run inside that image. Then we delegate to the general
+# build_and_run_docker.sh script.
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+export DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="java_oracle7"
+./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/java_oracle7/continuous.cfg b/kokoro/linux/java_oracle7/continuous.cfg
new file mode 100644
index 00000000..610469b4
--- /dev/null
+++ b/kokoro/linux/java_oracle7/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/java_oracle7/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/java_oracle7/presubmit.cfg b/kokoro/linux/java_oracle7/presubmit.cfg
new file mode 100644
index 00000000..610469b4
--- /dev/null
+++ b/kokoro/linux/java_oracle7/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/java_oracle7/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/javanano_jdk7/build.sh b/kokoro/linux/javanano_jdk7/build.sh
new file mode 100755
index 00000000..2fc06475
--- /dev/null
+++ b/kokoro/linux/javanano_jdk7/build.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "pull request" project:
+#
+# This script selects a specific Dockerfile (for building a Docker image) and
+# a script to run inside that image. Then we delegate to the general
+# build_and_run_docker.sh script.
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+export DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="javanano_jdk7"
+./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/javanano_jdk7/continuous.cfg b/kokoro/linux/javanano_jdk7/continuous.cfg
new file mode 100644
index 00000000..72936484
--- /dev/null
+++ b/kokoro/linux/javanano_jdk7/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/javanano_jdk7/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/javanano_jdk7/presubmit.cfg b/kokoro/linux/javanano_jdk7/presubmit.cfg
new file mode 100644
index 00000000..72936484
--- /dev/null
+++ b/kokoro/linux/javanano_jdk7/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/javanano_jdk7/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/javanano_oracle7/build.sh b/kokoro/linux/javanano_oracle7/build.sh
new file mode 100755
index 00000000..651d17e8
--- /dev/null
+++ b/kokoro/linux/javanano_oracle7/build.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "pull request" project:
+#
+# This script selects a specific Dockerfile (for building a Docker image) and
+# a script to run inside that image. Then we delegate to the general
+# build_and_run_docker.sh script.
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+export DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="javanano_oracle7"
+./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/javanano_oracle7/continuous.cfg b/kokoro/linux/javanano_oracle7/continuous.cfg
new file mode 100644
index 00000000..9cac8972
--- /dev/null
+++ b/kokoro/linux/javanano_oracle7/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/javanano_oracle7/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/javanano_oracle7/presubmit.cfg b/kokoro/linux/javanano_oracle7/presubmit.cfg
new file mode 100644
index 00000000..9cac8972
--- /dev/null
+++ b/kokoro/linux/javanano_oracle7/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/javanano_oracle7/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/javascript/build.sh b/kokoro/linux/javascript/build.sh
new file mode 100755
index 00000000..c2585fb7
--- /dev/null
+++ b/kokoro/linux/javascript/build.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "pull request" project:
+#
+# This script selects a specific Dockerfile (for building a Docker image) and
+# a script to run inside that image. Then we delegate to the general
+# build_and_run_docker.sh script.
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+export DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="javascript"
+./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/javascript/continuous.cfg b/kokoro/linux/javascript/continuous.cfg
new file mode 100644
index 00000000..b42f522f
--- /dev/null
+++ b/kokoro/linux/javascript/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/javascript/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/javascript/presubmit.cfg b/kokoro/linux/javascript/presubmit.cfg
new file mode 100644
index 00000000..b42f522f
--- /dev/null
+++ b/kokoro/linux/javascript/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/javascript/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/make_test_output.py b/kokoro/linux/make_test_output.py
new file mode 100644
index 00000000..98536853
--- /dev/null
+++ b/kokoro/linux/make_test_output.py
@@ -0,0 +1,94 @@
+"""Gathers output from test runs and create an XML file in JUnit format.
+
+The output files from the individual tests have been written in a directory
+structure like:
+
+ $DIR/joblog (output from "parallel --joblog joblog")
+ $DIR/logs/1/cpp/stdout
+ $DIR/logs/1/cpp/stderr
+ $DIR/logs/1/csharp/stdout
+ $DIR/logs/1/csharp/stderr
+ $DIR/logs/1/java_jdk7/stdout
+ $DIR/logs/1/java_jdk7/stderr
+ etc.
+
+This script bundles them into a single output XML file so Jenkins can show
+detailed test results. It runs as the last step before the Jenkins build
+finishes.
+"""
+
+import os
+import sys
+from yattag import Doc
+from collections import defaultdict
+
+
+def readtests(basedir):
+ tests = defaultdict(dict)
+
+ # Sample input (note: separators are tabs).
+ #
+ # Seq Host Starttime Runtime Send Receive Exitval Signal Command
+ # 1 : 1456263838.313 0.005 0 0 0 0 echo A
+ with open(basedir + "/joblog") as jobs:
+ firstline = next(jobs)
+ for line in jobs:
+ values = line.split("\t")
+
+ name = values[8].split()[-1]
+ test = tests[name]
+ test["name"] = name
+ test["time"] = values[3]
+
+ exitval = values[6]
+ if int(exitval):
+ # We don't have a more specific message. User should look at stderr.
+ test["failure"] = "TEST FAILURE"
+ else:
+ test["failure"] = False
+
+ for testname in os.listdir(basedir + "/logs/1"):
+ test = tests[testname]
+
+ with open(basedir + "/logs/1/" + testname + "/stdout") as f:
+ test["stdout"] = f.read()
+
+ with open(basedir + "/logs/1/" + testname + "/stderr") as f:
+ test["stderr"] = f.read()
+
+ # The cpp test is special since it doesn't run under parallel so doesn't show
+ # up in the job log.
+ tests["cpp"]["name"] = "cpp"
+
+ with open(basedir + '/logs/1/cpp/build_time', 'r') as f:
+ tests["cpp"]["time"] = f.read().strip()
+ tests["cpp"]["failure"] = False
+
+ ret = tests.values()
+ ret.sort(key=lambda x: x["name"])
+
+ return ret
+
+
+def genxml(tests):
+ doc, tag, text = Doc().tagtext()
+
+ with tag("testsuites"):
+ with tag("testsuite", name="Protobuf Tests"):
+ for test in tests:
+ with tag("testcase", name=test["name"], classname=test["name"],
+ time=test["time"]):
+ with tag("system-out"):
+ text(test["stdout"])
+ with tag("system-err"):
+ text(test["stderr"])
+ if test["failure"]:
+ with tag("failure"):
+ text(test["failure"])
+
+ return doc.getvalue()
+
+
+sys.stderr.write("make_test_output.py: writing XML from directory: " +
+ sys.argv[1] + "\n")
+print(genxml(readtests(sys.argv[1])))
diff --git a/kokoro/linux/php_all/build.sh b/kokoro/linux/php_all/build.sh
new file mode 100755
index 00000000..e9ab84cb
--- /dev/null
+++ b/kokoro/linux/php_all/build.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "pull request" project:
+#
+# This script selects a specific Dockerfile (for building a Docker image) and
+# a script to run inside that image. Then we delegate to the general
+# build_and_run_docker.sh script.
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+export DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="php_all"
+./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/php_all/continuous.cfg b/kokoro/linux/php_all/continuous.cfg
new file mode 100644
index 00000000..dfa8037e
--- /dev/null
+++ b/kokoro/linux/php_all/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/php_all/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/php_all/presubmit.cfg b/kokoro/linux/php_all/presubmit.cfg
new file mode 100644
index 00000000..dfa8037e
--- /dev/null
+++ b/kokoro/linux/php_all/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/php_all/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/pull_request_in_docker.sh b/kokoro/linux/pull_request_in_docker.sh
new file mode 100755
index 00000000..23e63961
--- /dev/null
+++ b/kokoro/linux/pull_request_in_docker.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+#
+# This is the script that runs inside Docker, once the image has been built,
+# to execute all tests for the "pull request" project.
+
+WORKSPACE_BASE=`pwd`
+MY_DIR="$(dirname "$0")"
+TEST_SCRIPT=$MY_DIR/../../tests.sh
+BUILD_DIR=/tmp/protobuf
+
+set -e # exit immediately on error
+set -x # display all commands
+
+# The protobuf repository is mounted into our Docker image, but read-only.
+# We clone into a directory inside Docker (this is faster than cp).
+rm -rf $BUILD_DIR
+mkdir -p $BUILD_DIR
+cd $BUILD_DIR
+git clone /var/local/kokoro/protobuf
+cd protobuf
+
+# Set up the directory where our test output is going to go.
+OUTPUT_DIR=`mktemp -d`
+LOG_OUTPUT_DIR=$OUTPUT_DIR/logs
+mkdir -p $LOG_OUTPUT_DIR/1/cpp
+
+################################################################################
+# cpp build needs to run first, non-parallelized, so that protoc is available
+# for other builds.
+
+# Output filenames to follow the overall scheme used by parallel, ie:
+# $DIR/logs/1/cpp/stdout
+# $DIR/logs/1/cpp/stderr
+# $DIR/logs/1/csharp/stdout
+# $DIR/logs/1/csharp/stderr
+# $DIR/logs/1/java_jdk7/stdout
+# $DIR/logs/1/java_jdk7/stderr
+CPP_STDOUT=$LOG_OUTPUT_DIR/1/cpp/stdout
+CPP_STDERR=$LOG_OUTPUT_DIR/1/cpp/stderr
+
+# Time the C++ build, so we can put this info in the test output.
+# It's important that we get /usr/bin/time (which supports -f and -o) and not
+# the bash builtin "time" which doesn't.
+TIME_CMD="/usr/bin/time -f %e -o $LOG_OUTPUT_DIR/1/cpp/build_time"
+
+$TIME_CMD $TEST_SCRIPT cpp > >(tee $CPP_STDOUT) 2> >(tee $CPP_STDERR >&2)
+
+# Other tests are run in parallel. TEST_SET is defined in
+# buildcmds/pull_request{_32}.sh
+
+parallel --results $LOG_OUTPUT_DIR --joblog $OUTPUT_DIR/joblog $TEST_SCRIPT ::: \
+ $TEST_SET \
+ || true # Process test results even if tests fail.
+
+cat $OUTPUT_DIR/joblog
+
+# The directory that is copied from Docker back into the Kokoro workspace.
+COPY_FROM_DOCKER=/var/local/git/protobuf/testoutput
+mkdir -p $COPY_FROM_DOCKER
+TESTOUTPUT_XML_FILE=$COPY_FROM_DOCKER/sponge_log.xml
+
+# Process all the output files from "parallel" and package them into a single
+# .xml file with detailed, broken-down test output.
+python $MY_DIR/make_test_output.py $OUTPUT_DIR > $TESTOUTPUT_XML_FILE
+
+ls -l $TESTOUTPUT_XML_FILE
diff --git a/kokoro/linux/python/build.sh b/kokoro/linux/python/build.sh
new file mode 100755
index 00000000..86964f55
--- /dev/null
+++ b/kokoro/linux/python/build.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "pull request" project:
+#
+# This script selects a specific Dockerfile (for building a Docker image) and
+# a script to run inside that image. Then we delegate to the general
+# build_and_run_docker.sh script.
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+export DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="python"
+./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/python/continuous.cfg b/kokoro/linux/python/continuous.cfg
new file mode 100644
index 00000000..e2fc4136
--- /dev/null
+++ b/kokoro/linux/python/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/python/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/python/presubmit.cfg b/kokoro/linux/python/presubmit.cfg
new file mode 100644
index 00000000..e2fc4136
--- /dev/null
+++ b/kokoro/linux/python/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/python/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/python_cpp/build.sh b/kokoro/linux/python_cpp/build.sh
new file mode 100755
index 00000000..add64651
--- /dev/null
+++ b/kokoro/linux/python_cpp/build.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "pull request" project:
+#
+# This script selects a specific Dockerfile (for building a Docker image) and
+# a script to run inside that image. Then we delegate to the general
+# build_and_run_docker.sh script.
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+export DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="python_cpp"
+./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/python_cpp/continuous.cfg b/kokoro/linux/python_cpp/continuous.cfg
new file mode 100644
index 00000000..b1b0e550
--- /dev/null
+++ b/kokoro/linux/python_cpp/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/python_cpp/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/python_cpp/presubmit.cfg b/kokoro/linux/python_cpp/presubmit.cfg
new file mode 100644
index 00000000..b1b0e550
--- /dev/null
+++ b/kokoro/linux/python_cpp/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/python_cpp/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/ruby_all/build.sh b/kokoro/linux/ruby_all/build.sh
new file mode 100755
index 00000000..ea758958
--- /dev/null
+++ b/kokoro/linux/ruby_all/build.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "pull request" project:
+#
+# This script selects a specific Dockerfile (for building a Docker image) and
+# a script to run inside that image. Then we delegate to the general
+# build_and_run_docker.sh script.
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+export DOCKERFILE_DIR=kokoro/linux/64-bit
+export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
+export OUTPUT_DIR=testoutput
+export TEST_SET="ruby_all"
+./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/ruby_all/continuous.cfg b/kokoro/linux/ruby_all/continuous.cfg
new file mode 100644
index 00000000..02d76437
--- /dev/null
+++ b/kokoro/linux/ruby_all/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/ruby_all/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/ruby_all/presubmit.cfg b/kokoro/linux/ruby_all/presubmit.cfg
new file mode 100644
index 00000000..02d76437
--- /dev/null
+++ b/kokoro/linux/ruby_all/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/ruby_all/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/objectivec/DevTools/full_mac_build.sh b/objectivec/DevTools/full_mac_build.sh
index a825789f..b34e28fc 100755
--- a/objectivec/DevTools/full_mac_build.sh
+++ b/objectivec/DevTools/full_mac_build.sh
@@ -253,36 +253,20 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then
XCODEBUILD_TEST_BASE_IOS+=(
-destination "platform=iOS Simulator,name=iPhone 4s,OS=9.0" # 32bit
-destination "platform=iOS Simulator,name=iPhone 7,OS=10.0" # 64bit
- -destination "platform=iOS Simulator,name=iPad 2,OS=9.0" # 32bit
- -destination "platform=iOS Simulator,name=iPad Pro (9.7 inch),OS=10.0" # 64bit
)
;;
- 8.1* )
- XCODEBUILD_TEST_BASE_IOS+=(
- -destination "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit
- -destination "platform=iOS Simulator,name=iPhone 7,OS=10.1" # 64bit
- -destination "platform=iOS Simulator,name=iPad 2,OS=8.1" # 32bit
- -destination "platform=iOS Simulator,name=iPad Pro (9.7 inch),OS=10.1" # 64bit
- )
- ;;
- 8.2* )
- XCODEBUILD_TEST_BASE_IOS+=(
- -destination "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit
- -destination "platform=iOS Simulator,name=iPhone 7,OS=10.2" # 64bit
- -destination "platform=iOS Simulator,name=iPad 2,OS=8.1" # 32bit
- -destination "platform=iOS Simulator,name=iPad Pro (9.7 inch),OS=10.2" # 64bit
- )
- ;;
- 8.3* )
+ 8.[1-3]* )
XCODEBUILD_TEST_BASE_IOS+=(
-destination "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit
-destination "platform=iOS Simulator,name=iPhone 7,OS=latest" # 64bit
)
;;
- 9.0* )
+ 9.[0-2]* )
XCODEBUILD_TEST_BASE_IOS+=(
-destination "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit
-destination "platform=iOS Simulator,name=iPhone 7,OS=latest" # 64bit
+ # 9.0-9.2 all seem to often fail running destinations in parallel
+ -disable-concurrent-testing
)
;;
* )
@@ -299,7 +283,7 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then
"${XCODEBUILD_TEST_BASE_IOS[@]}" -configuration Release test
fi
# Don't leave the simulator in the developer's face.
- killall Simulator
+ killall Simulator 2> /dev/null || true
fi
if [[ "${DO_XCODE_OSX_TESTS}" == "yes" ]] ; then
XCODEBUILD_TEST_BASE_OSX=(
diff --git a/objectivec/DevTools/pddm_tests.py b/objectivec/DevTools/pddm_tests.py
index 8a73b842..9ac6a855 100755
--- a/objectivec/DevTools/pddm_tests.py
+++ b/objectivec/DevTools/pddm_tests.py
@@ -311,7 +311,7 @@ foo(x, y)
mc = pddm.MacroCollection(f)
try:
result = mc.Expand('foo(A,B)')
- self.fail('Should throw exception, entry %d' % idx)
+ self.fail('Should throw exception! Test failed to catch recursion.')
except pddm.PDDMError as e:
self.assertEqual(e.message,
'Found macro recusion, invoking "foo(1, A)":\n...while expanding "bar(1, A)".\n...while expanding "foo(A,B)".')
@@ -483,7 +483,7 @@ foo
sf = pddm.SourceFile(f)
try:
sf.ProcessContent()
- self.fail('Should throw exception, entry %d' % idx)
+ self.fail('Should throw exception! Test failed to catch macro parsing error.')
except pddm.PDDMError as e:
self.assertEqual(e.message,
'Attempt to redefine macro: "PDDM-DEFINE mumble(x_)"\n'
@@ -503,7 +503,7 @@ foo
sf = pddm.SourceFile(f)
try:
sf.ProcessContent()
- self.fail('Should throw exception, entry %d' % idx)
+ self.fail('Should throw exception! Test failed to catch expand error.')
except pddm.PDDMError as e:
self.assertEqual(e.message,
'No macro named "foobar".\n'
diff --git a/objectivec/GPBCodedOutputStream.m b/objectivec/GPBCodedOutputStream.m
index c299040f..f832e8a6 100644
--- a/objectivec/GPBCodedOutputStream.m
+++ b/objectivec/GPBCodedOutputStream.m
@@ -174,10 +174,10 @@ static void GPBWriteRawLittleEndian64(GPBOutputBufferState *state,
data:(NSMutableData *)data {
if ((self = [super init])) {
buffer_ = [data retain];
- [output open];
state_.bytes = [data mutableBytes];
state_.size = [data length];
state_.output = [output retain];
+ [state_.output open];
}
return self;
}
diff --git a/objectivec/GPBDictionary.h b/objectivec/GPBDictionary.h
index 9d674150..a81165e8 100644
--- a/objectivec/GPBDictionary.h
+++ b/objectivec/GPBDictionary.h
@@ -60,55 +60,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithUInt32:(uint32_t)value
- forKey:(uint32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithUInt32s:(const uint32_t [__nullable])values
- forKeys:(const uint32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -204,55 +155,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithInt32:(int32_t)value
- forKey:(uint32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithInt32s:(const int32_t [__nullable])values
- forKeys:(const uint32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32Int32Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -348,55 +250,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithUInt64:(uint64_t)value
- forKey:(uint32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithUInt64s:(const uint64_t [__nullable])values
- forKeys:(const uint32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -492,55 +345,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithInt64:(int64_t)value
- forKey:(uint32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithInt64s:(const int64_t [__nullable])values
- forKeys:(const uint32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32Int64Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -636,55 +440,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithBool:(BOOL)value
- forKey:(uint32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithBools:(const BOOL [__nullable])values
- forKeys:(const uint32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32BoolDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -780,55 +535,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithFloat:(float)value
- forKey:(uint32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithFloats:(const float [__nullable])values
- forKeys:(const uint32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32FloatDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -924,55 +630,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithDouble:(double)value
- forKey:(uint32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithDoubles:(const double [__nullable])values
- forKeys:(const uint32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32DoubleDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -1070,70 +727,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given validation function.
- *
- * @param func The enum validation function for the dictionary.
- *
- * @return A newly instanced dictionary.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param func The enum validation function for the dictionary.
- * @param rawValue The raw enum value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- rawValue:(int32_t)rawValue
- forKey:(uint32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param func The enum validation function for the dictionary.
- * @param values The raw enum values values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- rawValues:(const int32_t [__nullable])values
- forKeys:(const uint32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32EnumDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param func The enum validation function for the dictionary.
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- capacity:(NSUInteger)numItems;
-
-/**
* Initializes a dictionary with the given validation function.
*
* @param func The enum validation function for the dictionary.
@@ -1294,55 +887,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param object The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithObject:(ObjectType)object
- forKey:(uint32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param objects The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects
- forKeys:(const uint32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32ObjectDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param objects The values to be placed in this dictionary.
@@ -1437,55 +981,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithUInt32:(uint32_t)value
- forKey:(int32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithUInt32s:(const uint32_t [__nullable])values
- forKeys:(const int32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt32UInt32Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -1581,55 +1076,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithInt32:(int32_t)value
- forKey:(int32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithInt32s:(const int32_t [__nullable])values
- forKeys:(const int32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt32Int32Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -1725,55 +1171,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithUInt64:(uint64_t)value
- forKey:(int32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithUInt64s:(const uint64_t [__nullable])values
- forKeys:(const int32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt32UInt64Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -1869,55 +1266,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithInt64:(int64_t)value
- forKey:(int32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithInt64s:(const int64_t [__nullable])values
- forKeys:(const int32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt32Int64Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -2013,55 +1361,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithBool:(BOOL)value
- forKey:(int32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithBools:(const BOOL [__nullable])values
- forKeys:(const int32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt32BoolDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -2157,55 +1456,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithFloat:(float)value
- forKey:(int32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithFloats:(const float [__nullable])values
- forKeys:(const int32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt32FloatDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -2301,55 +1551,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithDouble:(double)value
- forKey:(int32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithDoubles:(const double [__nullable])values
- forKeys:(const int32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt32DoubleDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -2447,70 +1648,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given validation function.
- *
- * @param func The enum validation function for the dictionary.
- *
- * @return A newly instanced dictionary.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param func The enum validation function for the dictionary.
- * @param rawValue The raw enum value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- rawValue:(int32_t)rawValue
- forKey:(int32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param func The enum validation function for the dictionary.
- * @param values The raw enum values values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- rawValues:(const int32_t [__nullable])values
- forKeys:(const int32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt32EnumDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param func The enum validation function for the dictionary.
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- capacity:(NSUInteger)numItems;
-
-/**
* Initializes a dictionary with the given validation function.
*
* @param func The enum validation function for the dictionary.
@@ -2671,55 +1808,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param object The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithObject:(ObjectType)object
- forKey:(int32_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param objects The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects
- forKeys:(const int32_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt32ObjectDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param objects The values to be placed in this dictionary.
@@ -2814,55 +1902,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithUInt32:(uint32_t)value
- forKey:(uint64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithUInt32s:(const uint32_t [__nullable])values
- forKeys:(const uint64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -2958,55 +1997,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithInt32:(int32_t)value
- forKey:(uint64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithInt32s:(const int32_t [__nullable])values
- forKeys:(const uint64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64Int32Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -3102,55 +2092,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithUInt64:(uint64_t)value
- forKey:(uint64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithUInt64s:(const uint64_t [__nullable])values
- forKeys:(const uint64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -3246,55 +2187,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithInt64:(int64_t)value
- forKey:(uint64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithInt64s:(const int64_t [__nullable])values
- forKeys:(const uint64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64Int64Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -3390,55 +2282,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithBool:(BOOL)value
- forKey:(uint64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithBools:(const BOOL [__nullable])values
- forKeys:(const uint64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64BoolDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -3534,55 +2377,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithFloat:(float)value
- forKey:(uint64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithFloats:(const float [__nullable])values
- forKeys:(const uint64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64FloatDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -3678,55 +2472,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithDouble:(double)value
- forKey:(uint64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithDoubles:(const double [__nullable])values
- forKeys:(const uint64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64DoubleDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -3824,70 +2569,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given validation function.
- *
- * @param func The enum validation function for the dictionary.
- *
- * @return A newly instanced dictionary.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param func The enum validation function for the dictionary.
- * @param rawValue The raw enum value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- rawValue:(int32_t)rawValue
- forKey:(uint64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param func The enum validation function for the dictionary.
- * @param values The raw enum values values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- rawValues:(const int32_t [__nullable])values
- forKeys:(const uint64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64EnumDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param func The enum validation function for the dictionary.
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- capacity:(NSUInteger)numItems;
-
-/**
* Initializes a dictionary with the given validation function.
*
* @param func The enum validation function for the dictionary.
@@ -4048,55 +2729,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param object The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithObject:(ObjectType)object
- forKey:(uint64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param objects The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects
- forKeys:(const uint64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64ObjectDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param objects The values to be placed in this dictionary.
@@ -4191,55 +2823,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithUInt32:(uint32_t)value
- forKey:(int64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithUInt32s:(const uint32_t [__nullable])values
- forKeys:(const int64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt64UInt32Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -4335,55 +2918,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithInt32:(int32_t)value
- forKey:(int64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithInt32s:(const int32_t [__nullable])values
- forKeys:(const int64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt64Int32Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -4479,55 +3013,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithUInt64:(uint64_t)value
- forKey:(int64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithUInt64s:(const uint64_t [__nullable])values
- forKeys:(const int64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt64UInt64Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -4623,55 +3108,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithInt64:(int64_t)value
- forKey:(int64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithInt64s:(const int64_t [__nullable])values
- forKeys:(const int64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt64Int64Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -4767,55 +3203,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithBool:(BOOL)value
- forKey:(int64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithBools:(const BOOL [__nullable])values
- forKeys:(const int64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt64BoolDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -4911,55 +3298,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithFloat:(float)value
- forKey:(int64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithFloats:(const float [__nullable])values
- forKeys:(const int64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt64FloatDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -5055,55 +3393,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithDouble:(double)value
- forKey:(int64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithDoubles:(const double [__nullable])values
- forKeys:(const int64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt64DoubleDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -5201,70 +3490,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given validation function.
- *
- * @param func The enum validation function for the dictionary.
- *
- * @return A newly instanced dictionary.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param func The enum validation function for the dictionary.
- * @param rawValue The raw enum value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- rawValue:(int32_t)rawValue
- forKey:(int64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param func The enum validation function for the dictionary.
- * @param values The raw enum values values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- rawValues:(const int32_t [__nullable])values
- forKeys:(const int64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt64EnumDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param func The enum validation function for the dictionary.
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- capacity:(NSUInteger)numItems;
-
-/**
* Initializes a dictionary with the given validation function.
*
* @param func The enum validation function for the dictionary.
@@ -5425,55 +3650,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param object The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithObject:(ObjectType)object
- forKey:(int64_t)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param objects The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects
- forKeys:(const int64_t [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBInt64ObjectDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param objects The values to be placed in this dictionary.
@@ -5568,55 +3744,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithUInt32:(uint32_t)value
- forKey:(BOOL)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithUInt32s:(const uint32_t [__nullable])values
- forKeys:(const BOOL [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBBoolUInt32Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -5712,55 +3839,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithInt32:(int32_t)value
- forKey:(BOOL)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithInt32s:(const int32_t [__nullable])values
- forKeys:(const BOOL [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBBoolInt32Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -5856,55 +3934,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithUInt64:(uint64_t)value
- forKey:(BOOL)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithUInt64s:(const uint64_t [__nullable])values
- forKeys:(const BOOL [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBBoolUInt64Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -6000,55 +4029,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithInt64:(int64_t)value
- forKey:(BOOL)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithInt64s:(const int64_t [__nullable])values
- forKeys:(const BOOL [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBBoolInt64Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -6144,55 +4124,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithBool:(BOOL)value
- forKey:(BOOL)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithBools:(const BOOL [__nullable])values
- forKeys:(const BOOL [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBBoolBoolDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -6288,55 +4219,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithFloat:(float)value
- forKey:(BOOL)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithFloats:(const float [__nullable])values
- forKeys:(const BOOL [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBBoolFloatDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -6432,55 +4314,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithDouble:(double)value
- forKey:(BOOL)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithDoubles:(const double [__nullable])values
- forKeys:(const BOOL [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBBoolDoubleDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -6578,70 +4411,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given validation function.
- *
- * @param func The enum validation function for the dictionary.
- *
- * @return A newly instanced dictionary.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param func The enum validation function for the dictionary.
- * @param rawValue The raw enum value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- rawValue:(int32_t)rawValue
- forKey:(BOOL)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param func The enum validation function for the dictionary.
- * @param values The raw enum values values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- rawValues:(const int32_t [__nullable])values
- forKeys:(const BOOL [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBBoolEnumDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param func The enum validation function for the dictionary.
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- capacity:(NSUInteger)numItems;
-
-/**
* Initializes a dictionary with the given validation function.
*
* @param func The enum validation function for the dictionary.
@@ -6802,55 +4571,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param object The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithObject:(ObjectType)object
- forKey:(BOOL)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param objects The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects
- forKeys:(const BOOL [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBBoolObjectDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param objects The values to be placed in this dictionary.
@@ -6945,55 +4665,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithUInt32:(uint32_t)value
- forKey:(NSString *)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithUInt32s:(const uint32_t [__nullable])values
- forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBStringUInt32Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -7089,55 +4760,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithInt32:(int32_t)value
- forKey:(NSString *)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithInt32s:(const int32_t [__nullable])values
- forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBStringInt32Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -7233,55 +4855,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithUInt64:(uint64_t)value
- forKey:(NSString *)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithUInt64s:(const uint64_t [__nullable])values
- forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBStringUInt64Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -7377,55 +4950,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithInt64:(int64_t)value
- forKey:(NSString *)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithInt64s:(const int64_t [__nullable])values
- forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBStringInt64Dictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -7521,55 +5045,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithBool:(BOOL)value
- forKey:(NSString *)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithBools:(const BOOL [__nullable])values
- forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBStringBoolDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -7665,55 +5140,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithFloat:(float)value
- forKey:(NSString *)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithFloats:(const float [__nullable])values
- forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBStringFloatDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -7809,55 +5235,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param value The value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithDouble:(double)value
- forKey:(NSString *)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param values The values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithDoubles:(const double [__nullable])values
- forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBStringDoubleDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-
-/**
* Initializes this dictionary, copying the given values and keys.
*
* @param values The values to be placed in this dictionary.
@@ -7955,70 +5332,6 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
/**
- * @return A newly instanced and empty dictionary.
- **/
-+ (instancetype)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given validation function.
- *
- * @param func The enum validation function for the dictionary.
- *
- * @return A newly instanced dictionary.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
-
-/**
- * Creates and initializes a dictionary with the single entry given.
- *
- * @param func The enum validation function for the dictionary.
- * @param rawValue The raw enum value to be placed in the dictionary.
- * @param key The key under which to store the value.
- *
- * @return A newly instanced dictionary with the key and value in it.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- rawValue:(int32_t)rawValue
- forKey:(NSString *)key;
-
-/**
- * Creates and initializes a dictionary with the entries given.
- *
- * @param func The enum validation function for the dictionary.
- * @param values The raw enum values values to be placed in the dictionary.
- * @param keys The keys under which to store the values.
- * @param count The number of entries to store in the dictionary.
- *
- * @return A newly instanced dictionary with the keys and values in it.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- rawValues:(const int32_t [__nullable])values
- forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
- count:(NSUInteger)count;
-
-/**
- * Creates and initializes a dictionary with the entries from the given.
- * dictionary.
- *
- * @param dictionary Dictionary containing the entries to add to the dictionary.
- *
- * @return A newly instanced dictionary with the entries from the given
- * dictionary in it.
- **/
-+ (instancetype)dictionaryWithDictionary:(GPBStringEnumDictionary *)dictionary;
-
-/**
- * Creates and initializes a dictionary with the given capacity.
- *
- * @param func The enum validation function for the dictionary.
- * @param numItems Capacity needed for the dictionary.
- *
- * @return A newly instanced dictionary with the given capacity.
- **/
-+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
- capacity:(NSUInteger)numItems;
-
-/**
* Initializes a dictionary with the given validation function.
*
* @param func The enum validation function for the dictionary.
@@ -8240,55 +5553,6 @@ NS_ASSUME_NONNULL_END
//%@property(nonatomic, readonly) NSUInteger count;
//%
//%/**
-//% * @return A newly instanced and empty dictionary.
-//% **/
-//%+ (instancetype)dictionary;
-//%
-//%/**
-//% * Creates and initializes a dictionary with the single entry given.
-//% *
-//% * @param ##VNAME_VAR The value to be placed in the dictionary.
-//% * @param key ##VNAME_VAR$S## The key under which to store the value.
-//% *
-//% * @return A newly instanced dictionary with the key and value in it.
-//% **/
-//%+ (instancetype)dictionaryWith##VNAME##:(VALUE_TYPE)##VNAME_VAR
-//% ##VNAME$S## forKey:(KEY_TYPE##KisP$S##KisP)key;
-//%
-//%/**
-//% * Creates and initializes a dictionary with the entries given.
-//% *
-//% * @param ##VNAME_VAR##s The values to be placed in the dictionary.
-//% * @param keys ##VNAME_VAR$S## The keys under which to store the values.
-//% * @param count ##VNAME_VAR$S## The number of entries to store in the dictionary.
-//% *
-//% * @return A newly instanced dictionary with the keys and values in it.
-//% **/
-//%+ (instancetype)dictionaryWith##VNAME##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[__nullable])##VNAME_VAR##s
-//% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[__nullable])keys
-//% ##VNAME$S## count:(NSUInteger)count;
-//%
-//%/**
-//% * Creates and initializes a dictionary with the entries from the given.
-//% * dictionary.
-//% *
-//% * @param dictionary Dictionary containing the entries to add to the dictionary.
-//% *
-//% * @return A newly instanced dictionary with the entries from the given
-//% * dictionary in it.
-//% **/
-//%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
-//%
-//%/**
-//% * Creates and initializes a dictionary with the given capacity.
-//% *
-//% * @param numItems Capacity needed for the dictionary.
-//% *
-//% * @return A newly instanced dictionary with the given capacity.
-//% **/
-//%+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-//%
-//%/**
//% * Initializes this dictionary, copying the given values and keys.
//% *
//% * @param ##VNAME_VAR##s The values to be placed in this dictionary.
@@ -8353,70 +5617,6 @@ NS_ASSUME_NONNULL_END
//%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
//%
//%/**
-//% * @return A newly instanced and empty dictionary.
-//% **/
-//%+ (instancetype)dictionary;
-//%
-//%/**
-//% * Creates and initializes a dictionary with the given validation function.
-//% *
-//% * @param func The enum validation function for the dictionary.
-//% *
-//% * @return A newly instanced dictionary.
-//% **/
-//%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
-//%
-//%/**
-//% * Creates and initializes a dictionary with the single entry given.
-//% *
-//% * @param func The enum validation function for the dictionary.
-//% * @param rawValue The raw enum value to be placed in the dictionary.
-//% * @param key The key under which to store the value.
-//% *
-//% * @return A newly instanced dictionary with the key and value in it.
-//% **/
-//%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
-//% rawValue:(VALUE_TYPE)rawValue
-//% forKey:(KEY_TYPE##KisP$S##KisP)key;
-//%
-//%/**
-//% * Creates and initializes a dictionary with the entries given.
-//% *
-//% * @param func The enum validation function for the dictionary.
-//% * @param values The raw enum values values to be placed in the dictionary.
-//% * @param keys The keys under which to store the values.
-//% * @param count The number of entries to store in the dictionary.
-//% *
-//% * @return A newly instanced dictionary with the keys and values in it.
-//% **/
-//%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
-//% rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[__nullable])values
-//% forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[__nullable])keys
-//% count:(NSUInteger)count;
-//%
-//%/**
-//% * Creates and initializes a dictionary with the entries from the given.
-//% * dictionary.
-//% *
-//% * @param dictionary Dictionary containing the entries to add to the dictionary.
-//% *
-//% * @return A newly instanced dictionary with the entries from the given
-//% * dictionary in it.
-//% **/
-//%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
-//%
-//%/**
-//% * Creates and initializes a dictionary with the given capacity.
-//% *
-//% * @param func The enum validation function for the dictionary.
-//% * @param numItems Capacity needed for the dictionary.
-//% *
-//% * @return A newly instanced dictionary with the given capacity.
-//% **/
-//%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
-//% capacity:(NSUInteger)numItems;
-//%
-//%/**
//% * Initializes a dictionary with the given validation function.
//% *
//% * @param func The enum validation function for the dictionary.
diff --git a/objectivec/GPBDictionary.m b/objectivec/GPBDictionary.m
index 7713376e..aa21670a 100644
--- a/objectivec/GPBDictionary.m
+++ b/objectivec/GPBDictionary.m
@@ -596,39 +596,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
//% NSMutableDictionary *_dictionary;
//%}
//%
-//%+ (instancetype)dictionary {
-//% return [[[self alloc] initWith##VNAME##s:NULL forKeys:NULL count:0] autorelease];
-//%}
-//%
-//%+ (instancetype)dictionaryWith##VNAME##:(VALUE_TYPE)##VNAME_VAR
-//% ##VNAME$S## forKey:(KEY_TYPE##KisP$S##KisP)key {
-//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME##s:forKeys:count:
-//% // on to get the type correct.
-//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME##s:&##VNAME_VAR
-//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:&key
-//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:1] autorelease];
-//%}
-//%
-//%+ (instancetype)dictionaryWith##VNAME##s:(const VALUE_TYPE [])##VNAME_VAR##s
-//% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP [])keys
-//% ##VNAME$S## count:(NSUInteger)count {
-//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME##s:forKeys:count:
-//% // on to get the type correct.
-//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME##s:##VNAME_VAR##s
-//% KEY_NAME$S VALUE_NAME$S forKeys:keys
-//% KEY_NAME$S VALUE_NAME$S count:count] autorelease];
-//%}
-//%
-//%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary {
-//% // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
-//% // on to get the type correct.
-//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-//%}
-//%
-//%+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
-//% return [[[self alloc] initWithCapacity:numItems] autorelease];
-//%}
-//%
//%- (instancetype)init {
//% return [self initWith##VNAME##s:NULL forKeys:NULL count:0];
//%}
@@ -685,54 +652,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
//%
//%@synthesize validationFunc = _validationFunc;
//%
-//%+ (instancetype)dictionary {
-//% return [[[self alloc] initWithValidationFunction:NULL
-//% rawValues:NULL
-//% forKeys:NULL
-//% count:0] autorelease];
-//%}
-//%
-//%+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func {
-//% return [[[self alloc] initWithValidationFunction:func
-//% rawValues:NULL
-//% forKeys:NULL
-//% count:0] autorelease];
-//%}
-//%
-//%+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
-//% rawValue:(VALUE_TYPE)rawValue
-//% forKey:(KEY_TYPE##KisP$S##KisP)key {
-//% // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
-//% // on to get the type correct.
-//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWithValidationFunction:func
-//% KEY_NAME$S VALUE_NAME$S rawValues:&rawValue
-//% KEY_NAME$S VALUE_NAME$S forKeys:&key
-//% KEY_NAME$S VALUE_NAME$S count:1] autorelease];
-//%}
-//%
-//%+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
-//% rawValues:(const VALUE_TYPE [])rawValues
-//% forKeys:(const KEY_TYPE##KisP$S##KisP [])keys
-//% count:(NSUInteger)count {
-//% // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
-//% // on to get the type correct.
-//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWithValidationFunction:func
-//% KEY_NAME$S VALUE_NAME$S rawValues:rawValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:keys
-//% KEY_NAME$S VALUE_NAME$S count:count] autorelease];
-//%}
-//%
-//%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary {
-//% // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
-//% // on to get the type correct.
-//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-//%}
-//%
-//%+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
-//% capacity:(NSUInteger)numItems {
-//% return [[[self alloc] initWithValidationFunction:func capacity:numItems] autorelease];
-//%}
-//%
//%- (instancetype)init {
//% return [self initWithValidationFunction:NULL rawValues:NULL forKeys:NULL count:0];
//%}
@@ -988,39 +907,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
//% VALUE_TYPE _values[2];
//%BOOL_DICT_HAS_STORAGE_##HELPER()}
//%
-//%+ (instancetype)dictionary {
-//% return [[[self alloc] initWith##VNAME##s:NULL forKeys:NULL count:0] autorelease];
-//%}
-//%
-//%+ (instancetype)dictionaryWith##VNAME##:(VALUE_TYPE)VNAME_VAR
-//% ##VNAME$S## forKey:(BOOL)key {
-//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME##s:forKeys:count:
-//% // on to get the type correct.
-//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME##s:&##VNAME_VAR
-//% VALUE_NAME$S ##VNAME$S## forKeys:&key
-//% VALUE_NAME$S ##VNAME$S## count:1] autorelease];
-//%}
-//%
-//%+ (instancetype)dictionaryWith##VNAME##s:(const VALUE_TYPE [])##VNAME_VAR##s
-//% ##VNAME$S## forKeys:(const BOOL [])keys
-//% ##VNAME$S## count:(NSUInteger)count {
-//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME##s:forKeys:count:
-//% // on to get the type correct.
-//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME##s:##VNAME_VAR##s
-//% VALUE_NAME$S ##VNAME$S## forKeys:keys
-//% VALUE_NAME$S ##VNAME$S## count:count] autorelease];
-//%}
-//%
-//%+ (instancetype)dictionaryWithDictionary:(GPBBool##VALUE_NAME##Dictionary *)dictionary {
-//% // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
-//% // on to get the type correct.
-//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-//%}
-//%
-//%+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
-//% return [[[self alloc] initWithCapacity:numItems] autorelease];
-//%}
-//%
//%- (instancetype)init {
//% return [self initWith##VNAME##s:NULL forKeys:NULL count:0];
//%}
@@ -1549,39 +1435,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithUInt32s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt32:(uint32_t)value
- forKey:(uint32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32UInt32Dictionary*)[self alloc] initWithUInt32s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32UInt32Dictionary*)[self alloc] initWithUInt32s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt32UInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithUInt32s:NULL forKeys:NULL count:0];
}
@@ -1765,39 +1618,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithInt32s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt32:(int32_t)value
- forKey:(uint32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32Int32Dictionary*)[self alloc] initWithInt32s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt32s:(const int32_t [])values
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32Int32Dictionary*)[self alloc] initWithInt32s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32Int32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt32Int32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithInt32s:NULL forKeys:NULL count:0];
}
@@ -1981,39 +1801,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithUInt64s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt64:(uint64_t)value
- forKey:(uint32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32UInt64Dictionary*)[self alloc] initWithUInt64s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32UInt64Dictionary*)[self alloc] initWithUInt64s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt32UInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithUInt64s:NULL forKeys:NULL count:0];
}
@@ -2197,39 +1984,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithInt64s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt64:(int64_t)value
- forKey:(uint32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32Int64Dictionary*)[self alloc] initWithInt64s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt64s:(const int64_t [])values
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32Int64Dictionary*)[self alloc] initWithInt64s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32Int64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt32Int64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithInt64s:NULL forKeys:NULL count:0];
}
@@ -2413,39 +2167,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithBools:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithBool:(BOOL)value
- forKey:(uint32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32BoolDictionary*)[self alloc] initWithBools:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithBools:(const BOOL [])values
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32BoolDictionary*)[self alloc] initWithBools:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32BoolDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt32BoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithBools:NULL forKeys:NULL count:0];
}
@@ -2629,39 +2350,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithFloats:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithFloat:(float)value
- forKey:(uint32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32FloatDictionary*)[self alloc] initWithFloats:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithFloats:(const float [])values
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32FloatDictionary*)[self alloc] initWithFloats:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32FloatDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt32FloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithFloats:NULL forKeys:NULL count:0];
}
@@ -2845,39 +2533,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithDoubles:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithDouble:(double)value
- forKey:(uint32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32DoubleDictionary*)[self alloc] initWithDoubles:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithDoubles:(const double [])values
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32DoubleDictionary*)[self alloc] initWithDoubles:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32DoubleDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt32DoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithDoubles:NULL forKeys:NULL count:0];
}
@@ -3064,54 +2719,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
@synthesize validationFunc = _validationFunc;
-+ (instancetype)dictionary {
- return [[[self alloc] initWithValidationFunction:NULL
- rawValues:NULL
- forKeys:NULL
- count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func {
- return [[[self alloc] initWithValidationFunction:func
- rawValues:NULL
- forKeys:NULL
- count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- rawValue:(int32_t)rawValue
- forKey:(uint32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32EnumDictionary*)[self alloc] initWithValidationFunction:func
- rawValues:&rawValue
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- rawValues:(const int32_t [])rawValues
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32EnumDictionary*)[self alloc] initWithValidationFunction:func
- rawValues:rawValues
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32EnumDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32EnumDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- capacity:(NSUInteger)numItems {
- return [[[self alloc] initWithValidationFunction:func capacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithValidationFunction:NULL rawValues:NULL forKeys:NULL count:0];
}
@@ -3361,39 +2968,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithObject:(id)object
- forKey:(uint32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32ObjectDictionary*)[self alloc] initWithObjects:&object
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithObjects:(const id [])objects
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt32ObjectDictionary*)[self alloc] initWithObjects:objects
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt32ObjectDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt32ObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithObjects:NULL forKeys:NULL count:0];
}
@@ -3609,39 +3183,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithUInt32s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt32:(uint32_t)value
- forKey:(int32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32UInt32Dictionary*)[self alloc] initWithUInt32s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32UInt32Dictionary*)[self alloc] initWithUInt32s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt32UInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt32UInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithUInt32s:NULL forKeys:NULL count:0];
}
@@ -3825,39 +3366,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithInt32s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt32:(int32_t)value
- forKey:(int32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32Int32Dictionary*)[self alloc] initWithInt32s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt32s:(const int32_t [])values
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32Int32Dictionary*)[self alloc] initWithInt32s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt32Int32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt32Int32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithInt32s:NULL forKeys:NULL count:0];
}
@@ -4041,39 +3549,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithUInt64s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt64:(uint64_t)value
- forKey:(int32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32UInt64Dictionary*)[self alloc] initWithUInt64s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32UInt64Dictionary*)[self alloc] initWithUInt64s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt32UInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt32UInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithUInt64s:NULL forKeys:NULL count:0];
}
@@ -4257,39 +3732,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithInt64s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt64:(int64_t)value
- forKey:(int32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32Int64Dictionary*)[self alloc] initWithInt64s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt64s:(const int64_t [])values
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32Int64Dictionary*)[self alloc] initWithInt64s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt32Int64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt32Int64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithInt64s:NULL forKeys:NULL count:0];
}
@@ -4473,39 +3915,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithBools:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithBool:(BOOL)value
- forKey:(int32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32BoolDictionary*)[self alloc] initWithBools:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithBools:(const BOOL [])values
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32BoolDictionary*)[self alloc] initWithBools:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt32BoolDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt32BoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithBools:NULL forKeys:NULL count:0];
}
@@ -4689,39 +4098,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithFloats:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithFloat:(float)value
- forKey:(int32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32FloatDictionary*)[self alloc] initWithFloats:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithFloats:(const float [])values
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32FloatDictionary*)[self alloc] initWithFloats:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt32FloatDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt32FloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithFloats:NULL forKeys:NULL count:0];
}
@@ -4905,39 +4281,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithDoubles:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithDouble:(double)value
- forKey:(int32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32DoubleDictionary*)[self alloc] initWithDoubles:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithDoubles:(const double [])values
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32DoubleDictionary*)[self alloc] initWithDoubles:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt32DoubleDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt32DoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithDoubles:NULL forKeys:NULL count:0];
}
@@ -5124,54 +4467,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
@synthesize validationFunc = _validationFunc;
-+ (instancetype)dictionary {
- return [[[self alloc] initWithValidationFunction:NULL
- rawValues:NULL
- forKeys:NULL
- count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func {
- return [[[self alloc] initWithValidationFunction:func
- rawValues:NULL
- forKeys:NULL
- count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- rawValue:(int32_t)rawValue
- forKey:(int32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32EnumDictionary*)[self alloc] initWithValidationFunction:func
- rawValues:&rawValue
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- rawValues:(const int32_t [])rawValues
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32EnumDictionary*)[self alloc] initWithValidationFunction:func
- rawValues:rawValues
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt32EnumDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32EnumDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- capacity:(NSUInteger)numItems {
- return [[[self alloc] initWithValidationFunction:func capacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithValidationFunction:NULL rawValues:NULL forKeys:NULL count:0];
}
@@ -5421,39 +4716,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithObject:(id)object
- forKey:(int32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32ObjectDictionary*)[self alloc] initWithObjects:&object
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithObjects:(const id [])objects
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt32ObjectDictionary*)[self alloc] initWithObjects:objects
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt32ObjectDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt32ObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithObjects:NULL forKeys:NULL count:0];
}
@@ -5669,39 +4931,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithUInt32s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt32:(uint32_t)value
- forKey:(uint64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64UInt32Dictionary*)[self alloc] initWithUInt32s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64UInt32Dictionary*)[self alloc] initWithUInt32s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt64UInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithUInt32s:NULL forKeys:NULL count:0];
}
@@ -5885,39 +5114,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithInt32s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt32:(int32_t)value
- forKey:(uint64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64Int32Dictionary*)[self alloc] initWithInt32s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt32s:(const int32_t [])values
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64Int32Dictionary*)[self alloc] initWithInt32s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64Int32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt64Int32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithInt32s:NULL forKeys:NULL count:0];
}
@@ -6101,39 +5297,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithUInt64s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt64:(uint64_t)value
- forKey:(uint64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64UInt64Dictionary*)[self alloc] initWithUInt64s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64UInt64Dictionary*)[self alloc] initWithUInt64s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt64UInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithUInt64s:NULL forKeys:NULL count:0];
}
@@ -6317,39 +5480,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithInt64s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt64:(int64_t)value
- forKey:(uint64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64Int64Dictionary*)[self alloc] initWithInt64s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt64s:(const int64_t [])values
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64Int64Dictionary*)[self alloc] initWithInt64s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64Int64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt64Int64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithInt64s:NULL forKeys:NULL count:0];
}
@@ -6533,39 +5663,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithBools:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithBool:(BOOL)value
- forKey:(uint64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64BoolDictionary*)[self alloc] initWithBools:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithBools:(const BOOL [])values
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64BoolDictionary*)[self alloc] initWithBools:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64BoolDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt64BoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithBools:NULL forKeys:NULL count:0];
}
@@ -6749,39 +5846,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithFloats:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithFloat:(float)value
- forKey:(uint64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64FloatDictionary*)[self alloc] initWithFloats:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithFloats:(const float [])values
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64FloatDictionary*)[self alloc] initWithFloats:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64FloatDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt64FloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithFloats:NULL forKeys:NULL count:0];
}
@@ -6965,39 +6029,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithDoubles:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithDouble:(double)value
- forKey:(uint64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64DoubleDictionary*)[self alloc] initWithDoubles:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithDoubles:(const double [])values
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64DoubleDictionary*)[self alloc] initWithDoubles:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64DoubleDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt64DoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithDoubles:NULL forKeys:NULL count:0];
}
@@ -7184,54 +6215,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
@synthesize validationFunc = _validationFunc;
-+ (instancetype)dictionary {
- return [[[self alloc] initWithValidationFunction:NULL
- rawValues:NULL
- forKeys:NULL
- count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func {
- return [[[self alloc] initWithValidationFunction:func
- rawValues:NULL
- forKeys:NULL
- count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- rawValue:(int32_t)rawValue
- forKey:(uint64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64EnumDictionary*)[self alloc] initWithValidationFunction:func
- rawValues:&rawValue
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- rawValues:(const int32_t [])rawValues
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64EnumDictionary*)[self alloc] initWithValidationFunction:func
- rawValues:rawValues
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64EnumDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64EnumDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- capacity:(NSUInteger)numItems {
- return [[[self alloc] initWithValidationFunction:func capacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithValidationFunction:NULL rawValues:NULL forKeys:NULL count:0];
}
@@ -7481,39 +6464,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithObject:(id)object
- forKey:(uint64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64ObjectDictionary*)[self alloc] initWithObjects:&object
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithObjects:(const id [])objects
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
- // on to get the type correct.
- return [[(GPBUInt64ObjectDictionary*)[self alloc] initWithObjects:objects
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBUInt64ObjectDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBUInt64ObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithObjects:NULL forKeys:NULL count:0];
}
@@ -7729,39 +6679,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithUInt32s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt32:(uint32_t)value
- forKey:(int64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64UInt32Dictionary*)[self alloc] initWithUInt32s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64UInt32Dictionary*)[self alloc] initWithUInt32s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt64UInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt64UInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithUInt32s:NULL forKeys:NULL count:0];
}
@@ -7945,39 +6862,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithInt32s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt32:(int32_t)value
- forKey:(int64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64Int32Dictionary*)[self alloc] initWithInt32s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt32s:(const int32_t [])values
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64Int32Dictionary*)[self alloc] initWithInt32s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt64Int32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt64Int32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithInt32s:NULL forKeys:NULL count:0];
}
@@ -8161,39 +7045,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithUInt64s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt64:(uint64_t)value
- forKey:(int64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64UInt64Dictionary*)[self alloc] initWithUInt64s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64UInt64Dictionary*)[self alloc] initWithUInt64s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt64UInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt64UInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithUInt64s:NULL forKeys:NULL count:0];
}
@@ -8377,39 +7228,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithInt64s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt64:(int64_t)value
- forKey:(int64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64Int64Dictionary*)[self alloc] initWithInt64s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt64s:(const int64_t [])values
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64Int64Dictionary*)[self alloc] initWithInt64s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt64Int64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt64Int64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithInt64s:NULL forKeys:NULL count:0];
}
@@ -8593,39 +7411,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithBools:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithBool:(BOOL)value
- forKey:(int64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64BoolDictionary*)[self alloc] initWithBools:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithBools:(const BOOL [])values
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64BoolDictionary*)[self alloc] initWithBools:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt64BoolDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt64BoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithBools:NULL forKeys:NULL count:0];
}
@@ -8809,39 +7594,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithFloats:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithFloat:(float)value
- forKey:(int64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64FloatDictionary*)[self alloc] initWithFloats:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithFloats:(const float [])values
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64FloatDictionary*)[self alloc] initWithFloats:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt64FloatDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt64FloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithFloats:NULL forKeys:NULL count:0];
}
@@ -9025,39 +7777,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithDoubles:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithDouble:(double)value
- forKey:(int64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64DoubleDictionary*)[self alloc] initWithDoubles:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithDoubles:(const double [])values
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64DoubleDictionary*)[self alloc] initWithDoubles:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt64DoubleDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt64DoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithDoubles:NULL forKeys:NULL count:0];
}
@@ -9244,54 +7963,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
@synthesize validationFunc = _validationFunc;
-+ (instancetype)dictionary {
- return [[[self alloc] initWithValidationFunction:NULL
- rawValues:NULL
- forKeys:NULL
- count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func {
- return [[[self alloc] initWithValidationFunction:func
- rawValues:NULL
- forKeys:NULL
- count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- rawValue:(int32_t)rawValue
- forKey:(int64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64EnumDictionary*)[self alloc] initWithValidationFunction:func
- rawValues:&rawValue
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- rawValues:(const int32_t [])rawValues
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64EnumDictionary*)[self alloc] initWithValidationFunction:func
- rawValues:rawValues
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt64EnumDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64EnumDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- capacity:(NSUInteger)numItems {
- return [[[self alloc] initWithValidationFunction:func capacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithValidationFunction:NULL rawValues:NULL forKeys:NULL count:0];
}
@@ -9541,39 +8212,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithObject:(id)object
- forKey:(int64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64ObjectDictionary*)[self alloc] initWithObjects:&object
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithObjects:(const id [])objects
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
- // on to get the type correct.
- return [[(GPBInt64ObjectDictionary*)[self alloc] initWithObjects:objects
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBInt64ObjectDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBInt64ObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithObjects:NULL forKeys:NULL count:0];
}
@@ -9789,39 +8427,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithUInt32s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt32:(uint32_t)value
- forKey:(NSString *)key {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringUInt32Dictionary*)[self alloc] initWithUInt32s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
- forKeys:(const NSString * [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringUInt32Dictionary*)[self alloc] initWithUInt32s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBStringUInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBStringUInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithUInt32s:NULL forKeys:NULL count:0];
}
@@ -10013,39 +8618,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithInt32s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt32:(int32_t)value
- forKey:(NSString *)key {
- // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringInt32Dictionary*)[self alloc] initWithInt32s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt32s:(const int32_t [])values
- forKeys:(const NSString * [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringInt32Dictionary*)[self alloc] initWithInt32s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBStringInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBStringInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithInt32s:NULL forKeys:NULL count:0];
}
@@ -10237,39 +8809,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithUInt64s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt64:(uint64_t)value
- forKey:(NSString *)key {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringUInt64Dictionary*)[self alloc] initWithUInt64s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
- forKeys:(const NSString * [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringUInt64Dictionary*)[self alloc] initWithUInt64s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBStringUInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBStringUInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithUInt64s:NULL forKeys:NULL count:0];
}
@@ -10461,39 +9000,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithInt64s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt64:(int64_t)value
- forKey:(NSString *)key {
- // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringInt64Dictionary*)[self alloc] initWithInt64s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt64s:(const int64_t [])values
- forKeys:(const NSString * [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringInt64Dictionary*)[self alloc] initWithInt64s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBStringInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBStringInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithInt64s:NULL forKeys:NULL count:0];
}
@@ -10685,39 +9191,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithBools:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithBool:(BOOL)value
- forKey:(NSString *)key {
- // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringBoolDictionary*)[self alloc] initWithBools:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithBools:(const BOOL [])values
- forKeys:(const NSString * [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringBoolDictionary*)[self alloc] initWithBools:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBStringBoolDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBStringBoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithBools:NULL forKeys:NULL count:0];
}
@@ -10909,39 +9382,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithFloats:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithFloat:(float)value
- forKey:(NSString *)key {
- // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringFloatDictionary*)[self alloc] initWithFloats:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithFloats:(const float [])values
- forKeys:(const NSString * [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringFloatDictionary*)[self alloc] initWithFloats:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBStringFloatDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBStringFloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithFloats:NULL forKeys:NULL count:0];
}
@@ -11133,39 +9573,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
NSMutableDictionary *_dictionary;
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithDoubles:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithDouble:(double)value
- forKey:(NSString *)key {
- // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringDoubleDictionary*)[self alloc] initWithDoubles:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithDoubles:(const double [])values
- forKeys:(const NSString * [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringDoubleDictionary*)[self alloc] initWithDoubles:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBStringDoubleDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBStringDoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithDoubles:NULL forKeys:NULL count:0];
}
@@ -11360,54 +9767,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
@synthesize validationFunc = _validationFunc;
-+ (instancetype)dictionary {
- return [[[self alloc] initWithValidationFunction:NULL
- rawValues:NULL
- forKeys:NULL
- count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func {
- return [[[self alloc] initWithValidationFunction:func
- rawValues:NULL
- forKeys:NULL
- count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- rawValue:(int32_t)rawValue
- forKey:(NSString *)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringEnumDictionary*)[self alloc] initWithValidationFunction:func
- rawValues:&rawValue
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- rawValues:(const int32_t [])rawValues
- forKeys:(const NSString * [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringEnumDictionary*)[self alloc] initWithValidationFunction:func
- rawValues:rawValues
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBStringEnumDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBStringEnumDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- capacity:(NSUInteger)numItems {
- return [[[self alloc] initWithValidationFunction:func capacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithValidationFunction:NULL rawValues:NULL forKeys:NULL count:0];
}
@@ -11676,39 +10035,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
BOOL _valueSet[2];
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithUInt32s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt32:(uint32_t)value
- forKey:(BOOL)key {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolUInt32Dictionary*)[self alloc] initWithUInt32s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolUInt32Dictionary*)[self alloc] initWithUInt32s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBBoolUInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBBoolUInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithUInt32s:NULL forKeys:NULL count:0];
}
@@ -11918,39 +10244,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
BOOL _valueSet[2];
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithInt32s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt32:(int32_t)value
- forKey:(BOOL)key {
- // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolInt32Dictionary*)[self alloc] initWithInt32s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt32s:(const int32_t [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolInt32Dictionary*)[self alloc] initWithInt32s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBBoolInt32Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBBoolInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithInt32s:NULL forKeys:NULL count:0];
}
@@ -12160,39 +10453,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
BOOL _valueSet[2];
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithUInt64s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt64:(uint64_t)value
- forKey:(BOOL)key {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolUInt64Dictionary*)[self alloc] initWithUInt64s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolUInt64Dictionary*)[self alloc] initWithUInt64s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBBoolUInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBBoolUInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithUInt64s:NULL forKeys:NULL count:0];
}
@@ -12402,39 +10662,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
BOOL _valueSet[2];
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithInt64s:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt64:(int64_t)value
- forKey:(BOOL)key {
- // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolInt64Dictionary*)[self alloc] initWithInt64s:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithInt64s:(const int64_t [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolInt64Dictionary*)[self alloc] initWithInt64s:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBBoolInt64Dictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBBoolInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithInt64s:NULL forKeys:NULL count:0];
}
@@ -12644,39 +10871,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
BOOL _valueSet[2];
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithBools:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithBool:(BOOL)value
- forKey:(BOOL)key {
- // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolBoolDictionary*)[self alloc] initWithBools:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithBools:(const BOOL [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolBoolDictionary*)[self alloc] initWithBools:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBBoolBoolDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBBoolBoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithBools:NULL forKeys:NULL count:0];
}
@@ -12886,39 +11080,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
BOOL _valueSet[2];
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithFloats:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithFloat:(float)value
- forKey:(BOOL)key {
- // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolFloatDictionary*)[self alloc] initWithFloats:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithFloats:(const float [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolFloatDictionary*)[self alloc] initWithFloats:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBBoolFloatDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBBoolFloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithFloats:NULL forKeys:NULL count:0];
}
@@ -13128,39 +11289,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
BOOL _valueSet[2];
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithDoubles:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithDouble:(double)value
- forKey:(BOOL)key {
- // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolDoubleDictionary*)[self alloc] initWithDoubles:&value
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithDoubles:(const double [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolDoubleDictionary*)[self alloc] initWithDoubles:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBBoolDoubleDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBBoolDoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithDoubles:NULL forKeys:NULL count:0];
}
@@ -13369,39 +11497,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
id _values[2];
}
-+ (instancetype)dictionary {
- return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithObject:(id)object
- forKey:(BOOL)key {
- // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolObjectDictionary*)[self alloc] initWithObjects:&object
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithObjects:(const id [])objects
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolObjectDictionary*)[self alloc] initWithObjects:objects
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBBoolObjectDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithDictionary:
- // on to get the type correct.
- return [[(GPBBoolObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems {
- return [[[self alloc] initWithCapacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithObjects:NULL forKeys:NULL count:0];
}
@@ -13635,54 +11730,6 @@ void GPBDictionaryReadEntry(id mapDictionary,
@synthesize validationFunc = _validationFunc;
-+ (instancetype)dictionary {
- return [[[self alloc] initWithValidationFunction:NULL
- rawValues:NULL
- forKeys:NULL
- count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func {
- return [[[self alloc] initWithValidationFunction:func
- rawValues:NULL
- forKeys:NULL
- count:0] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- rawValue:(int32_t)rawValue
- forKey:(BOOL)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolEnumDictionary*)[self alloc] initWithValidationFunction:func
- rawValues:&rawValue
- forKeys:&key
- count:1] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- rawValues:(const int32_t [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolEnumDictionary*)[self alloc] initWithValidationFunction:func
- rawValues:values
- forKeys:keys
- count:count] autorelease];
-}
-
-+ (instancetype)dictionaryWithDictionary:(GPBBoolEnumDictionary *)dictionary {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
- // on to get the type correct.
- return [[(GPBBoolEnumDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
-}
-
-+ (instancetype)dictionaryWithValidationFunction:(GPBEnumValidationFunc)func
- capacity:(NSUInteger)numItems {
- return [[[self alloc] initWithValidationFunction:func capacity:numItems] autorelease];
-}
-
- (instancetype)init {
return [self initWithValidationFunction:NULL rawValues:NULL forKeys:NULL count:0];
}
diff --git a/objectivec/GPBMessage.m b/objectivec/GPBMessage.m
index 37cff6ce..90485bd1 100644
--- a/objectivec/GPBMessage.m
+++ b/objectivec/GPBMessage.m
@@ -2591,13 +2591,14 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
if (other == self) {
return YES;
}
- if (![other isKindOfClass:[self class]] &&
- ![self isKindOfClass:[other class]]) {
+ if (![other isKindOfClass:[GPBMessage class]]) {
return NO;
}
-
GPBMessage *otherMsg = other;
GPBDescriptor *descriptor = [[self class] descriptor];
+ if ([[otherMsg class] descriptor] != descriptor) {
+ return NO;
+ }
uint8_t *selfStorage = (uint8_t *)messageStorage_;
uint8_t *otherStorage = (uint8_t *)otherMsg->messageStorage_;
@@ -2997,7 +2998,10 @@ typedef struct ResolveIvarAccessorMethodResult {
SEL encodingSelector;
} ResolveIvarAccessorMethodResult;
-static void ResolveIvarGet(GPBFieldDescriptor *field,
+// |field| can be __unsafe_unretained because they are created at startup
+// and are essentially global. No need to pay for retain/release when
+// they are captured in blocks.
+static void ResolveIvarGet(__unsafe_unretained GPBFieldDescriptor *field,
ResolveIvarAccessorMethodResult *result) {
GPBDataType fieldDataType = GPBGetFieldDataType(field);
switch (fieldDataType) {
@@ -3039,7 +3043,8 @@ static void ResolveIvarGet(GPBFieldDescriptor *field,
}
}
-static void ResolveIvarSet(GPBFieldDescriptor *field,
+// See comment about __unsafe_unretained on ResolveIvarGet.
+static void ResolveIvarSet(__unsafe_unretained GPBFieldDescriptor *field,
GPBFileSyntax syntax,
ResolveIvarAccessorMethodResult *result) {
GPBDataType fieldDataType = GPBGetFieldDataType(field);
@@ -3083,9 +3088,10 @@ static void ResolveIvarSet(GPBFieldDescriptor *field,
// NOTE: hasOrCountSel_/setHasSel_ will be NULL if the field for the given
// message should not have has support (done in GPBDescriptor.m), so there is
// no need for checks here to see if has*/setHas* are allowed.
-
ResolveIvarAccessorMethodResult result = {NULL, NULL};
- for (GPBFieldDescriptor *field in descriptor->fields_) {
+
+ // See comment about __unsafe_unretained on ResolveIvarGet.
+ for (__unsafe_unretained GPBFieldDescriptor *field in descriptor->fields_) {
BOOL isMapOrArray = GPBFieldIsMapOrArray(field);
if (!isMapOrArray) {
// Single fields.
diff --git a/objectivec/GPBRootObject.m b/objectivec/GPBRootObject.m
index 585d205a..bad2f9a7 100644
--- a/objectivec/GPBRootObject.m
+++ b/objectivec/GPBRootObject.m
@@ -43,6 +43,14 @@
- (const char *)singletonNameC;
@end
+// We need some object to conform to the MessageSignatureProtocol to make sure
+// the selectors in it are recorded in our Objective C runtime information.
+// GPBMessage is arguably the more "obvious" choice, but given that all messages
+// inherit from GPBMessage, conflicts seem likely, so we are using GPBRootObject
+// instead.
+@interface GPBRootObject () <GPBMessageSignatureProtocol>
+@end
+
@implementation GPBRootObject
// Taken from http://www.burtleburtle.net/bob/hash/doobs.html
diff --git a/objectivec/GPBUtilities.m b/objectivec/GPBUtilities.m
index 5029ec73..77ea9577 100644
--- a/objectivec/GPBUtilities.m
+++ b/objectivec/GPBUtilities.m
@@ -49,6 +49,19 @@ static void AppendTextFormatForMessage(GPBMessage *message,
NSMutableString *toStr,
NSString *lineIndent);
+// Are two datatypes the same basic type representation (ex Int32 and SInt32).
+// Marked unused because currently only called from asserts/debug.
+static BOOL DataTypesEquivalent(GPBDataType type1,
+ GPBDataType type2) __attribute__ ((unused));
+
+// Basic type representation for a type (ex: for SInt32 it is Int32).
+// Marked unused because currently only called from asserts/debug.
+static GPBDataType BaseDataType(GPBDataType type) __attribute__ ((unused));
+
+// String name for a data type.
+// Marked unused because currently only called from asserts/debug.
+static NSString *TypeToString(GPBDataType dataType) __attribute__ ((unused));
+
NSData *GPBEmptyNSData(void) {
static dispatch_once_t onceToken;
static NSData *defaultNSData = nil;
@@ -342,6 +355,14 @@ void GPBMaybeClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof,
//%PDDM-DEFINE IVAR_POD_ACCESSORS_DEFN(NAME, TYPE)
//%TYPE GPBGetMessage##NAME##Field(GPBMessage *self,
//% TYPE$S NAME$S GPBFieldDescriptor *field) {
+//%#if defined(DEBUG) && DEBUG
+//% NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+//% GPBDataType##NAME),
+//% @"Attempting to get value of TYPE from field %@ "
+//% @"of %@ which is of type %@.",
+//% [self class], field.name,
+//% TypeToString(GPBGetFieldDataType(field)));
+//%#endif
//% if (GPBGetHasIvarField(self, field)) {
//% uint8_t *storage = (uint8_t *)self->messageStorage_;
//% TYPE *typePtr = (TYPE *)&storage[field->description_->offset];
@@ -364,14 +385,24 @@ void GPBMaybeClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof,
//% NAME$S GPBFieldDescriptor *field,
//% NAME$S TYPE value,
//% NAME$S GPBFileSyntax syntax) {
+//%#if defined(DEBUG) && DEBUG
+//% NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+//% GPBDataType##NAME),
+//% @"Attempting to set field %@ of %@ which is of type %@ with "
+//% @"value of type TYPE.",
+//% [self class], field.name,
+//% TypeToString(GPBGetFieldDataType(field)));
+//%#endif
//% GPBOneofDescriptor *oneof = field->containingOneof_;
//% if (oneof) {
//% GPBMessageFieldDescription *fieldDesc = field->description_;
//% GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
//% }
+//%#if defined(DEBUG) && DEBUG
//% NSCAssert(self->messageStorage_ != NULL,
//% @"%@: All messages should have storage (from init)",
//% [self class]);
+//%#endif
//%#if defined(__clang_analyzer__)
//% if (self->messageStorage_ == NULL) return;
//%#endif
@@ -391,6 +422,14 @@ void GPBMaybeClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof,
//%// Only exists for public api, no core code should use this.
//%TYPE *GPBGetMessage##NAME##Field(GPBMessage *self,
//% TYPE$S NAME$S GPBFieldDescriptor *field) {
+//%#if defined(DEBUG) && DEBUG
+//% NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+//% GPBDataType##NAME),
+//% @"Attempting to get value of TYPE from field %@ "
+//% @"of %@ which is of type %@.",
+//% [self class], field.name,
+//% TypeToString(GPBGetFieldDataType(field)));
+//%#endif
//% return (TYPE *)GPBGetObjectIvarWithField(self, field);
//%}
//%
@@ -398,6 +437,14 @@ void GPBMaybeClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof,
//%void GPBSetMessage##NAME##Field(GPBMessage *self,
//% NAME$S GPBFieldDescriptor *field,
//% NAME$S TYPE *value) {
+//%#if defined(DEBUG) && DEBUG
+//% NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+//% GPBDataType##NAME),
+//% @"Attempting to set field %@ of %@ which is of type %@ with "
+//% @"value of type TYPE.",
+//% [self class], field.name,
+//% TypeToString(GPBGetFieldDataType(field)));
+//%#endif
//% GPBSetObjectIvarWithField(self, field, (id)value);
//%}
//%
@@ -455,7 +502,7 @@ void GPBSetRetainedObjectIvarWithFieldInternal(GPBMessage *self,
GPBDataType fieldType = GPBGetFieldDataType(field);
BOOL isMapOrArray = GPBFieldIsMapOrArray(field);
BOOL fieldIsMessage = GPBDataTypeIsMessage(fieldType);
-#ifdef DEBUG
+#if defined(DEBUG) && DEBUG
if (value == nil && !isMapOrArray && !fieldIsMessage &&
field.hasDefaultValue) {
// Setting a message to nil is an obvious way to "clear" the value
@@ -618,6 +665,13 @@ int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field) {
int32_t GPBGetEnumIvarWithFieldInternal(GPBMessage *self,
GPBFieldDescriptor *field,
GPBFileSyntax syntax) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(GPBGetFieldDataType(field) == GPBDataTypeEnum,
+ @"Attempting to get value of type Enum from field %@ "
+ @"of %@ which is of type %@.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
int32_t result = GPBGetMessageInt32Field(self, field);
// If this is presevering unknown enums, make sure the value is valid before
// returning it.
@@ -638,6 +692,13 @@ void GPBSetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field,
void GPBSetEnumIvarWithFieldInternal(GPBMessage *self,
GPBFieldDescriptor *field, int32_t value,
GPBFileSyntax syntax) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(GPBGetFieldDataType(field) == GPBDataTypeEnum,
+ @"Attempting to set field %@ of %@ which is of type %@ with "
+ @"value of type Enum.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
// Don't allow in unknown values. Proto3 can use the Raw method.
if (![field isValidEnumValue:value]) {
[NSException raise:NSInvalidArgumentException
@@ -663,6 +724,13 @@ void GPBSetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field,
BOOL GPBGetMessageBoolField(GPBMessage *self,
GPBFieldDescriptor *field) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field), GPBDataTypeBool),
+ @"Attempting to get value of type bool from field %@ "
+ @"of %@ which is of type %@.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
if (GPBGetHasIvarField(self, field)) {
// Bools are stored in the has bits to avoid needing explicit space in the
// storage structure.
@@ -688,6 +756,13 @@ void GPBSetBoolIvarWithFieldInternal(GPBMessage *self,
GPBFieldDescriptor *field,
BOOL value,
GPBFileSyntax syntax) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field), GPBDataTypeBool),
+ @"Attempting to set field %@ of %@ which is of type %@ with "
+ @"value of type bool.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
GPBMessageFieldDescription *fieldDesc = field->description_;
GPBOneofDescriptor *oneof = field->containingOneof_;
if (oneof) {
@@ -714,6 +789,14 @@ void GPBSetBoolIvarWithFieldInternal(GPBMessage *self,
int32_t GPBGetMessageInt32Field(GPBMessage *self,
GPBFieldDescriptor *field) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeInt32),
+ @"Attempting to get value of int32_t from field %@ "
+ @"of %@ which is of type %@.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
if (GPBGetHasIvarField(self, field)) {
uint8_t *storage = (uint8_t *)self->messageStorage_;
int32_t *typePtr = (int32_t *)&storage[field->description_->offset];
@@ -736,14 +819,24 @@ void GPBSetInt32IvarWithFieldInternal(GPBMessage *self,
GPBFieldDescriptor *field,
int32_t value,
GPBFileSyntax syntax) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeInt32),
+ @"Attempting to set field %@ of %@ which is of type %@ with "
+ @"value of type int32_t.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
GPBOneofDescriptor *oneof = field->containingOneof_;
if (oneof) {
GPBMessageFieldDescription *fieldDesc = field->description_;
GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
}
+#if defined(DEBUG) && DEBUG
NSCAssert(self->messageStorage_ != NULL,
@"%@: All messages should have storage (from init)",
[self class]);
+#endif
#if defined(__clang_analyzer__)
if (self->messageStorage_ == NULL) return;
#endif
@@ -764,6 +857,14 @@ void GPBSetInt32IvarWithFieldInternal(GPBMessage *self,
uint32_t GPBGetMessageUInt32Field(GPBMessage *self,
GPBFieldDescriptor *field) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeUInt32),
+ @"Attempting to get value of uint32_t from field %@ "
+ @"of %@ which is of type %@.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
if (GPBGetHasIvarField(self, field)) {
uint8_t *storage = (uint8_t *)self->messageStorage_;
uint32_t *typePtr = (uint32_t *)&storage[field->description_->offset];
@@ -786,14 +887,24 @@ void GPBSetUInt32IvarWithFieldInternal(GPBMessage *self,
GPBFieldDescriptor *field,
uint32_t value,
GPBFileSyntax syntax) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeUInt32),
+ @"Attempting to set field %@ of %@ which is of type %@ with "
+ @"value of type uint32_t.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
GPBOneofDescriptor *oneof = field->containingOneof_;
if (oneof) {
GPBMessageFieldDescription *fieldDesc = field->description_;
GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
}
+#if defined(DEBUG) && DEBUG
NSCAssert(self->messageStorage_ != NULL,
@"%@: All messages should have storage (from init)",
[self class]);
+#endif
#if defined(__clang_analyzer__)
if (self->messageStorage_ == NULL) return;
#endif
@@ -814,6 +925,14 @@ void GPBSetUInt32IvarWithFieldInternal(GPBMessage *self,
int64_t GPBGetMessageInt64Field(GPBMessage *self,
GPBFieldDescriptor *field) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeInt64),
+ @"Attempting to get value of int64_t from field %@ "
+ @"of %@ which is of type %@.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
if (GPBGetHasIvarField(self, field)) {
uint8_t *storage = (uint8_t *)self->messageStorage_;
int64_t *typePtr = (int64_t *)&storage[field->description_->offset];
@@ -836,14 +955,24 @@ void GPBSetInt64IvarWithFieldInternal(GPBMessage *self,
GPBFieldDescriptor *field,
int64_t value,
GPBFileSyntax syntax) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeInt64),
+ @"Attempting to set field %@ of %@ which is of type %@ with "
+ @"value of type int64_t.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
GPBOneofDescriptor *oneof = field->containingOneof_;
if (oneof) {
GPBMessageFieldDescription *fieldDesc = field->description_;
GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
}
+#if defined(DEBUG) && DEBUG
NSCAssert(self->messageStorage_ != NULL,
@"%@: All messages should have storage (from init)",
[self class]);
+#endif
#if defined(__clang_analyzer__)
if (self->messageStorage_ == NULL) return;
#endif
@@ -864,6 +993,14 @@ void GPBSetInt64IvarWithFieldInternal(GPBMessage *self,
uint64_t GPBGetMessageUInt64Field(GPBMessage *self,
GPBFieldDescriptor *field) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeUInt64),
+ @"Attempting to get value of uint64_t from field %@ "
+ @"of %@ which is of type %@.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
if (GPBGetHasIvarField(self, field)) {
uint8_t *storage = (uint8_t *)self->messageStorage_;
uint64_t *typePtr = (uint64_t *)&storage[field->description_->offset];
@@ -886,14 +1023,24 @@ void GPBSetUInt64IvarWithFieldInternal(GPBMessage *self,
GPBFieldDescriptor *field,
uint64_t value,
GPBFileSyntax syntax) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeUInt64),
+ @"Attempting to set field %@ of %@ which is of type %@ with "
+ @"value of type uint64_t.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
GPBOneofDescriptor *oneof = field->containingOneof_;
if (oneof) {
GPBMessageFieldDescription *fieldDesc = field->description_;
GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
}
+#if defined(DEBUG) && DEBUG
NSCAssert(self->messageStorage_ != NULL,
@"%@: All messages should have storage (from init)",
[self class]);
+#endif
#if defined(__clang_analyzer__)
if (self->messageStorage_ == NULL) return;
#endif
@@ -914,6 +1061,14 @@ void GPBSetUInt64IvarWithFieldInternal(GPBMessage *self,
float GPBGetMessageFloatField(GPBMessage *self,
GPBFieldDescriptor *field) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeFloat),
+ @"Attempting to get value of float from field %@ "
+ @"of %@ which is of type %@.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
if (GPBGetHasIvarField(self, field)) {
uint8_t *storage = (uint8_t *)self->messageStorage_;
float *typePtr = (float *)&storage[field->description_->offset];
@@ -936,14 +1091,24 @@ void GPBSetFloatIvarWithFieldInternal(GPBMessage *self,
GPBFieldDescriptor *field,
float value,
GPBFileSyntax syntax) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeFloat),
+ @"Attempting to set field %@ of %@ which is of type %@ with "
+ @"value of type float.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
GPBOneofDescriptor *oneof = field->containingOneof_;
if (oneof) {
GPBMessageFieldDescription *fieldDesc = field->description_;
GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
}
+#if defined(DEBUG) && DEBUG
NSCAssert(self->messageStorage_ != NULL,
@"%@: All messages should have storage (from init)",
[self class]);
+#endif
#if defined(__clang_analyzer__)
if (self->messageStorage_ == NULL) return;
#endif
@@ -964,6 +1129,14 @@ void GPBSetFloatIvarWithFieldInternal(GPBMessage *self,
double GPBGetMessageDoubleField(GPBMessage *self,
GPBFieldDescriptor *field) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeDouble),
+ @"Attempting to get value of double from field %@ "
+ @"of %@ which is of type %@.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
if (GPBGetHasIvarField(self, field)) {
uint8_t *storage = (uint8_t *)self->messageStorage_;
double *typePtr = (double *)&storage[field->description_->offset];
@@ -986,14 +1159,24 @@ void GPBSetDoubleIvarWithFieldInternal(GPBMessage *self,
GPBFieldDescriptor *field,
double value,
GPBFileSyntax syntax) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeDouble),
+ @"Attempting to set field %@ of %@ which is of type %@ with "
+ @"value of type double.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
GPBOneofDescriptor *oneof = field->containingOneof_;
if (oneof) {
GPBMessageFieldDescription *fieldDesc = field->description_;
GPBMaybeClearOneof(self, oneof, fieldDesc->hasIndex, fieldDesc->number);
}
+#if defined(DEBUG) && DEBUG
NSCAssert(self->messageStorage_ != NULL,
@"%@: All messages should have storage (from init)",
[self class]);
+#endif
#if defined(__clang_analyzer__)
if (self->messageStorage_ == NULL) return;
#endif
@@ -1019,6 +1202,14 @@ void GPBSetDoubleIvarWithFieldInternal(GPBMessage *self,
// Only exists for public api, no core code should use this.
NSString *GPBGetMessageStringField(GPBMessage *self,
GPBFieldDescriptor *field) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeString),
+ @"Attempting to get value of NSString from field %@ "
+ @"of %@ which is of type %@.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
return (NSString *)GPBGetObjectIvarWithField(self, field);
}
@@ -1026,6 +1217,14 @@ NSString *GPBGetMessageStringField(GPBMessage *self,
void GPBSetMessageStringField(GPBMessage *self,
GPBFieldDescriptor *field,
NSString *value) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeString),
+ @"Attempting to set field %@ of %@ which is of type %@ with "
+ @"value of type NSString.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
GPBSetObjectIvarWithField(self, field, (id)value);
}
@@ -1035,6 +1234,14 @@ void GPBSetMessageStringField(GPBMessage *self,
// Only exists for public api, no core code should use this.
NSData *GPBGetMessageBytesField(GPBMessage *self,
GPBFieldDescriptor *field) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeBytes),
+ @"Attempting to get value of NSData from field %@ "
+ @"of %@ which is of type %@.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
return (NSData *)GPBGetObjectIvarWithField(self, field);
}
@@ -1042,6 +1249,14 @@ NSData *GPBGetMessageBytesField(GPBMessage *self,
void GPBSetMessageBytesField(GPBMessage *self,
GPBFieldDescriptor *field,
NSData *value) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeBytes),
+ @"Attempting to set field %@ of %@ which is of type %@ with "
+ @"value of type NSData.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
GPBSetObjectIvarWithField(self, field, (id)value);
}
@@ -1051,6 +1266,14 @@ void GPBSetMessageBytesField(GPBMessage *self,
// Only exists for public api, no core code should use this.
GPBMessage *GPBGetMessageMessageField(GPBMessage *self,
GPBFieldDescriptor *field) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeMessage),
+ @"Attempting to get value of GPBMessage from field %@ "
+ @"of %@ which is of type %@.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
return (GPBMessage *)GPBGetObjectIvarWithField(self, field);
}
@@ -1058,6 +1281,14 @@ GPBMessage *GPBGetMessageMessageField(GPBMessage *self,
void GPBSetMessageMessageField(GPBMessage *self,
GPBFieldDescriptor *field,
GPBMessage *value) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeMessage),
+ @"Attempting to set field %@ of %@ which is of type %@ with "
+ @"value of type GPBMessage.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
GPBSetObjectIvarWithField(self, field, (id)value);
}
@@ -1067,6 +1298,14 @@ void GPBSetMessageMessageField(GPBMessage *self,
// Only exists for public api, no core code should use this.
GPBMessage *GPBGetMessageGroupField(GPBMessage *self,
GPBFieldDescriptor *field) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeGroup),
+ @"Attempting to get value of GPBMessage from field %@ "
+ @"of %@ which is of type %@.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
return (GPBMessage *)GPBGetObjectIvarWithField(self, field);
}
@@ -1074,6 +1313,14 @@ GPBMessage *GPBGetMessageGroupField(GPBMessage *self,
void GPBSetMessageGroupField(GPBMessage *self,
GPBFieldDescriptor *field,
GPBMessage *value) {
+#if defined(DEBUG) && DEBUG
+ NSCAssert(DataTypesEquivalent(GPBGetFieldDataType(field),
+ GPBDataTypeGroup),
+ @"Attempting to set field %@ of %@ which is of type %@ with "
+ @"value of type GPBMessage.",
+ [self class], field.name,
+ TypeToString(GPBGetFieldDataType(field)));
+#endif
GPBSetObjectIvarWithField(self, field, (id)value);
}
@@ -1137,8 +1384,40 @@ void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id
GPBSetObjectIvarWithField(self, field, array);
}
-#if defined(DEBUG) && DEBUG
-static NSString *TypeToStr(GPBDataType dataType) {
+static GPBDataType BaseDataType(GPBDataType type) {
+ switch (type) {
+ case GPBDataTypeSFixed32:
+ case GPBDataTypeInt32:
+ case GPBDataTypeSInt32:
+ case GPBDataTypeEnum:
+ return GPBDataTypeInt32;
+ case GPBDataTypeFixed32:
+ case GPBDataTypeUInt32:
+ return GPBDataTypeUInt32;
+ case GPBDataTypeSFixed64:
+ case GPBDataTypeInt64:
+ case GPBDataTypeSInt64:
+ return GPBDataTypeInt64;
+ case GPBDataTypeFixed64:
+ case GPBDataTypeUInt64:
+ return GPBDataTypeUInt64;
+ case GPBDataTypeMessage:
+ case GPBDataTypeGroup:
+ return GPBDataTypeMessage;
+ case GPBDataTypeBool:
+ case GPBDataTypeFloat:
+ case GPBDataTypeDouble:
+ case GPBDataTypeBytes:
+ case GPBDataTypeString:
+ return type;
+ }
+}
+
+static BOOL DataTypesEquivalent(GPBDataType type1, GPBDataType type2) {
+ return BaseDataType(type1) == BaseDataType(type2);
+}
+
+static NSString *TypeToString(GPBDataType dataType) {
switch (dataType) {
case GPBDataTypeBool:
return @"Bool";
@@ -1166,10 +1445,9 @@ static NSString *TypeToStr(GPBDataType dataType) {
case GPBDataTypeGroup:
return @"Object";
case GPBDataTypeEnum:
- return @"Bool";
+ return @"Enum";
}
}
-#endif
// GPBGetMessageMapField is defined in GPBMessage.m
@@ -1185,8 +1463,8 @@ void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field,
if (dictionary) {
GPBDataType keyDataType = field.mapKeyDataType;
GPBDataType valueDataType = GPBGetFieldDataType(field);
- NSString *keyStr = TypeToStr(keyDataType);
- NSString *valueStr = TypeToStr(valueDataType);
+ NSString *keyStr = TypeToString(keyDataType);
+ NSString *valueStr = TypeToString(valueDataType);
if (keyDataType == GPBDataTypeString) {
keyStr = @"String";
}
@@ -1216,8 +1494,11 @@ void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field,
const char *GPBMessageEncodingForSelector(SEL selector, BOOL instanceSel) {
Protocol *protocol =
objc_getProtocol(GPBStringifySymbol(GPBMessageSignatureProtocol));
+ NSCAssert(protocol, @"Missing GPBMessageSignatureProtocol");
struct objc_method_description description =
protocol_getMethodDescription(protocol, selector, NO, instanceSel);
+ NSCAssert(description.name != Nil && description.types != nil,
+ @"Missing method for selector %@", NSStringFromSelector(selector));
return description.types;
}
@@ -1911,13 +2192,3 @@ BOOL GPBClassHasSel(Class aClass, SEL sel) {
free(methodList);
return result;
}
-
-#pragma mark - GPBMessageSignatureProtocol
-
-// A series of selectors that are used solely to get @encoding values
-// for them by the dynamic protobuf runtime code. An object using the protocol
-// needs to be declared for the protocol to be valid at runtime.
-@interface GPBMessageSignatureProtocol : NSObject<GPBMessageSignatureProtocol>
-@end
-@implementation GPBMessageSignatureProtocol
-@end
diff --git a/objectivec/GPBUtilities_PackagePrivate.h b/objectivec/GPBUtilities_PackagePrivate.h
index 16859d48..c8b21ed7 100644
--- a/objectivec/GPBUtilities_PackagePrivate.h
+++ b/objectivec/GPBUtilities_PackagePrivate.h
@@ -309,7 +309,8 @@ NSString *GPBDecodeTextFormatName(const uint8_t *decodeData, int32_t key,
// A series of selectors that are used solely to get @encoding values
// for them by the dynamic protobuf runtime code. See
-// GPBMessageEncodingForSelector for details.
+// GPBMessageEncodingForSelector for details. GPBRootObject conforms to
+// the protocol so that it is encoded in the Objective C runtime.
@protocol GPBMessageSignatureProtocol
@optional
diff --git a/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj b/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
index 1f1172b2..9333ea7d 100644
--- a/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
+++ b/objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
@@ -880,7 +880,6 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
FRAMEWORK_SEARCH_PATHS = (
- "\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
"$(inherited)",
);
@@ -916,7 +915,6 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
FRAMEWORK_SEARCH_PATHS = (
- "\"$(SDKROOT)/Developer/Library/Frameworks\"",
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
"$(inherited)",
);
diff --git a/objectivec/Tests/GPBCodedInputStreamTests.m b/objectivec/Tests/GPBCodedInputStreamTests.m
index d8e128f7..11f7ceaf 100644
--- a/objectivec/Tests/GPBCodedInputStreamTests.m
+++ b/objectivec/Tests/GPBCodedInputStreamTests.m
@@ -261,7 +261,7 @@
GPBCodedInputStream* input32 = [GPBCodedInputStream streamWithData:data];
XCTAssertEqual(value32, [input32 readInt32]);
- int64_t value64 = INT64_MIN | (0x01L << 31);
+ int64_t value64 = INT64_MIN | (0x01LL << 31);
GPBCodedInputStream* input64 = [GPBCodedInputStream streamWithData:data];
XCTAssertEqual(value64, [input64 readInt64]);
}
diff --git a/objectivec/Tests/GPBDictionaryTests+Bool.m b/objectivec/Tests/GPBDictionaryTests+Bool.m
index 0dbe07b6..0af0c815 100644
--- a/objectivec/Tests/GPBDictionaryTests+Bool.m
+++ b/objectivec/Tests/GPBDictionaryTests+Bool.m
@@ -63,7 +63,8 @@
}
- (void)testOne {
- GPBBoolUInt32Dictionary *dict = [GPBBoolUInt32Dictionary dictionaryWithUInt32:100U forKey:YES];
+ GPBBoolUInt32Dictionary *dict = [[GPBBoolUInt32Dictionary alloc] init];
+ [dict setUInt32:100U forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint32_t value;
@@ -76,6 +77,7 @@
XCTAssertEqual(aValue, 100U);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -214,17 +216,18 @@
XCTAssertNotNil(dict);
GPBBoolUInt32Dictionary *dict2 =
- [GPBBoolUInt32Dictionary dictionaryWithDictionary:dict];
+ [[GPBBoolUInt32Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBBoolUInt32Dictionary *dict = [GPBBoolUInt32Dictionary dictionary];
+ GPBBoolUInt32Dictionary *dict = [[GPBBoolUInt32Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -249,6 +252,7 @@
XCTAssertTrue([dict getUInt32:&value forKey:NO]);
XCTAssertEqual(value, 101U);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -364,7 +368,8 @@
}
- (void)testOne {
- GPBBoolInt32Dictionary *dict = [GPBBoolInt32Dictionary dictionaryWithInt32:200 forKey:YES];
+ GPBBoolInt32Dictionary *dict = [[GPBBoolInt32Dictionary alloc] init];
+ [dict setInt32:200 forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -377,6 +382,7 @@
XCTAssertEqual(aValue, 200);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -515,17 +521,18 @@
XCTAssertNotNil(dict);
GPBBoolInt32Dictionary *dict2 =
- [GPBBoolInt32Dictionary dictionaryWithDictionary:dict];
+ [[GPBBoolInt32Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBBoolInt32Dictionary *dict = [GPBBoolInt32Dictionary dictionary];
+ GPBBoolInt32Dictionary *dict = [[GPBBoolInt32Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -550,6 +557,7 @@
XCTAssertTrue([dict getInt32:&value forKey:NO]);
XCTAssertEqual(value, 201);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -665,7 +673,8 @@
}
- (void)testOne {
- GPBBoolUInt64Dictionary *dict = [GPBBoolUInt64Dictionary dictionaryWithUInt64:300U forKey:YES];
+ GPBBoolUInt64Dictionary *dict = [[GPBBoolUInt64Dictionary alloc] init];
+ [dict setUInt64:300U forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint64_t value;
@@ -678,6 +687,7 @@
XCTAssertEqual(aValue, 300U);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -816,17 +826,18 @@
XCTAssertNotNil(dict);
GPBBoolUInt64Dictionary *dict2 =
- [GPBBoolUInt64Dictionary dictionaryWithDictionary:dict];
+ [[GPBBoolUInt64Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBBoolUInt64Dictionary *dict = [GPBBoolUInt64Dictionary dictionary];
+ GPBBoolUInt64Dictionary *dict = [[GPBBoolUInt64Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -851,6 +862,7 @@
XCTAssertTrue([dict getUInt64:&value forKey:NO]);
XCTAssertEqual(value, 301U);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -966,7 +978,8 @@
}
- (void)testOne {
- GPBBoolInt64Dictionary *dict = [GPBBoolInt64Dictionary dictionaryWithInt64:400 forKey:YES];
+ GPBBoolInt64Dictionary *dict = [[GPBBoolInt64Dictionary alloc] init];
+ [dict setInt64:400 forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int64_t value;
@@ -979,6 +992,7 @@
XCTAssertEqual(aValue, 400);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -1117,17 +1131,18 @@
XCTAssertNotNil(dict);
GPBBoolInt64Dictionary *dict2 =
- [GPBBoolInt64Dictionary dictionaryWithDictionary:dict];
+ [[GPBBoolInt64Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBBoolInt64Dictionary *dict = [GPBBoolInt64Dictionary dictionary];
+ GPBBoolInt64Dictionary *dict = [[GPBBoolInt64Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1152,6 +1167,7 @@
XCTAssertTrue([dict getInt64:&value forKey:NO]);
XCTAssertEqual(value, 401);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1267,7 +1283,8 @@
}
- (void)testOne {
- GPBBoolBoolDictionary *dict = [GPBBoolBoolDictionary dictionaryWithBool:NO forKey:YES];
+ GPBBoolBoolDictionary *dict = [[GPBBoolBoolDictionary alloc] init];
+ [dict setBool:NO forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
BOOL value;
@@ -1280,6 +1297,7 @@
XCTAssertEqual(aValue, NO);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -1418,17 +1436,18 @@
XCTAssertNotNil(dict);
GPBBoolBoolDictionary *dict2 =
- [GPBBoolBoolDictionary dictionaryWithDictionary:dict];
+ [[GPBBoolBoolDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBBoolBoolDictionary *dict = [GPBBoolBoolDictionary dictionary];
+ GPBBoolBoolDictionary *dict = [[GPBBoolBoolDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1453,6 +1472,7 @@
XCTAssertTrue([dict getBool:&value forKey:NO]);
XCTAssertEqual(value, YES);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1568,7 +1588,8 @@
}
- (void)testOne {
- GPBBoolFloatDictionary *dict = [GPBBoolFloatDictionary dictionaryWithFloat:500.f forKey:YES];
+ GPBBoolFloatDictionary *dict = [[GPBBoolFloatDictionary alloc] init];
+ [dict setFloat:500.f forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
float value;
@@ -1581,6 +1602,7 @@
XCTAssertEqual(aValue, 500.f);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -1719,17 +1741,18 @@
XCTAssertNotNil(dict);
GPBBoolFloatDictionary *dict2 =
- [GPBBoolFloatDictionary dictionaryWithDictionary:dict];
+ [[GPBBoolFloatDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBBoolFloatDictionary *dict = [GPBBoolFloatDictionary dictionary];
+ GPBBoolFloatDictionary *dict = [[GPBBoolFloatDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1754,6 +1777,7 @@
XCTAssertTrue([dict getFloat:&value forKey:NO]);
XCTAssertEqual(value, 501.f);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1869,7 +1893,8 @@
}
- (void)testOne {
- GPBBoolDoubleDictionary *dict = [GPBBoolDoubleDictionary dictionaryWithDouble:600. forKey:YES];
+ GPBBoolDoubleDictionary *dict = [[GPBBoolDoubleDictionary alloc] init];
+ [dict setDouble:600. forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
double value;
@@ -1882,6 +1907,7 @@
XCTAssertEqual(aValue, 600.);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2020,17 +2046,18 @@
XCTAssertNotNil(dict);
GPBBoolDoubleDictionary *dict2 =
- [GPBBoolDoubleDictionary dictionaryWithDictionary:dict];
+ [[GPBBoolDoubleDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBBoolDoubleDictionary *dict = [GPBBoolDoubleDictionary dictionary];
+ GPBBoolDoubleDictionary *dict = [[GPBBoolDoubleDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2055,6 +2082,7 @@
XCTAssertTrue([dict getDouble:&value forKey:NO]);
XCTAssertEqual(value, 601.);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -2170,7 +2198,8 @@
}
- (void)testOne {
- GPBBoolObjectDictionary<NSString*> *dict = [GPBBoolObjectDictionary dictionaryWithObject:@"abc" forKey:YES];
+ GPBBoolObjectDictionary<NSString*> *dict = [[GPBBoolObjectDictionary alloc] init];
+ [dict setObject:@"abc" forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
@@ -2180,6 +2209,7 @@
XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2313,17 +2343,18 @@
XCTAssertNotNil(dict);
GPBBoolObjectDictionary<NSString*> *dict2 =
- [GPBBoolObjectDictionary dictionaryWithDictionary:dict];
+ [[GPBBoolObjectDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBBoolObjectDictionary<NSString*> *dict = [GPBBoolObjectDictionary dictionary];
+ GPBBoolObjectDictionary<NSString*> *dict = [[GPBBoolObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2343,6 +2374,7 @@
XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
XCTAssertEqualObjects([dict objectForKey:NO], @"def");
[dict2 release];
+ [dict release];
}
- (void)testRemove {
diff --git a/objectivec/Tests/GPBDictionaryTests+Int32.m b/objectivec/Tests/GPBDictionaryTests+Int32.m
index c539bdc2..4ba30203 100644
--- a/objectivec/Tests/GPBDictionaryTests+Int32.m
+++ b/objectivec/Tests/GPBDictionaryTests+Int32.m
@@ -45,7 +45,6 @@
// To let the testing macros work, add some extra methods to simplify things.
@interface GPBInt32EnumDictionary (TestingTweak)
-+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(int32_t)key;
- (instancetype)initWithEnums:(const int32_t [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count;
@@ -64,14 +63,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
@implementation GPBInt32EnumDictionary (TestingTweak)
-+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(int32_t)key {
- // Cast is needed to compiler knows what class we are invoking initWithValues: on to get the
- // type correct.
- return [[(GPBInt32EnumDictionary*)[self alloc] initWithValidationFunction:TestingEnum_IsValidValue
- rawValues:&value
- forKeys:&key
- count:1] autorelease];
-}
- (instancetype)initWithEnums:(const int32_t [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count {
@@ -103,7 +94,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32UInt32Dictionary *dict = [GPBInt32UInt32Dictionary dictionaryWithUInt32:100U forKey:11];
+ GPBInt32UInt32Dictionary *dict = [[GPBInt32UInt32Dictionary alloc] init];
+ [dict setUInt32:100U forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint32_t value;
@@ -116,6 +108,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 100U);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -258,17 +251,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32UInt32Dictionary *dict2 =
- [GPBInt32UInt32Dictionary dictionaryWithDictionary:dict];
+ [[GPBInt32UInt32Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt32UInt32Dictionary *dict = [GPBInt32UInt32Dictionary dictionary];
+ GPBInt32UInt32Dictionary *dict = [[GPBInt32UInt32Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -299,6 +293,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt32:&value forKey:14]);
XCTAssertEqual(value, 103U);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -460,7 +455,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32Int32Dictionary *dict = [GPBInt32Int32Dictionary dictionaryWithInt32:200 forKey:11];
+ GPBInt32Int32Dictionary *dict = [[GPBInt32Int32Dictionary alloc] init];
+ [dict setInt32:200 forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -473,6 +469,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 200);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -615,17 +612,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32Int32Dictionary *dict2 =
- [GPBInt32Int32Dictionary dictionaryWithDictionary:dict];
+ [[GPBInt32Int32Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt32Int32Dictionary *dict = [GPBInt32Int32Dictionary dictionary];
+ GPBInt32Int32Dictionary *dict = [[GPBInt32Int32Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -656,6 +654,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt32:&value forKey:14]);
XCTAssertEqual(value, 203);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -817,7 +816,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32UInt64Dictionary *dict = [GPBInt32UInt64Dictionary dictionaryWithUInt64:300U forKey:11];
+ GPBInt32UInt64Dictionary *dict = [[GPBInt32UInt64Dictionary alloc] init];
+ [dict setUInt64:300U forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint64_t value;
@@ -830,6 +830,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 300U);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -972,17 +973,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32UInt64Dictionary *dict2 =
- [GPBInt32UInt64Dictionary dictionaryWithDictionary:dict];
+ [[GPBInt32UInt64Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt32UInt64Dictionary *dict = [GPBInt32UInt64Dictionary dictionary];
+ GPBInt32UInt64Dictionary *dict = [[GPBInt32UInt64Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1013,6 +1015,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt64:&value forKey:14]);
XCTAssertEqual(value, 303U);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1174,7 +1177,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32Int64Dictionary *dict = [GPBInt32Int64Dictionary dictionaryWithInt64:400 forKey:11];
+ GPBInt32Int64Dictionary *dict = [[GPBInt32Int64Dictionary alloc] init];
+ [dict setInt64:400 forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int64_t value;
@@ -1187,6 +1191,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 400);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -1329,17 +1334,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32Int64Dictionary *dict2 =
- [GPBInt32Int64Dictionary dictionaryWithDictionary:dict];
+ [[GPBInt32Int64Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt32Int64Dictionary *dict = [GPBInt32Int64Dictionary dictionary];
+ GPBInt32Int64Dictionary *dict = [[GPBInt32Int64Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1370,6 +1376,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt64:&value forKey:14]);
XCTAssertEqual(value, 403);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1531,7 +1538,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32BoolDictionary *dict = [GPBInt32BoolDictionary dictionaryWithBool:YES forKey:11];
+ GPBInt32BoolDictionary *dict = [[GPBInt32BoolDictionary alloc] init];
+ [dict setBool:YES forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
BOOL value;
@@ -1544,6 +1552,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, YES);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -1686,17 +1695,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32BoolDictionary *dict2 =
- [GPBInt32BoolDictionary dictionaryWithDictionary:dict];
+ [[GPBInt32BoolDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt32BoolDictionary *dict = [GPBInt32BoolDictionary dictionary];
+ GPBInt32BoolDictionary *dict = [[GPBInt32BoolDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1727,6 +1737,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getBool:&value forKey:14]);
XCTAssertEqual(value, NO);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1888,7 +1899,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32FloatDictionary *dict = [GPBInt32FloatDictionary dictionaryWithFloat:500.f forKey:11];
+ GPBInt32FloatDictionary *dict = [[GPBInt32FloatDictionary alloc] init];
+ [dict setFloat:500.f forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
float value;
@@ -1901,6 +1913,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 500.f);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2043,17 +2056,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32FloatDictionary *dict2 =
- [GPBInt32FloatDictionary dictionaryWithDictionary:dict];
+ [[GPBInt32FloatDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt32FloatDictionary *dict = [GPBInt32FloatDictionary dictionary];
+ GPBInt32FloatDictionary *dict = [[GPBInt32FloatDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2084,6 +2098,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getFloat:&value forKey:14]);
XCTAssertEqual(value, 503.f);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -2245,7 +2260,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32DoubleDictionary *dict = [GPBInt32DoubleDictionary dictionaryWithDouble:600. forKey:11];
+ GPBInt32DoubleDictionary *dict = [[GPBInt32DoubleDictionary alloc] init];
+ [dict setDouble:600. forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
double value;
@@ -2258,6 +2274,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 600.);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2400,17 +2417,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32DoubleDictionary *dict2 =
- [GPBInt32DoubleDictionary dictionaryWithDictionary:dict];
+ [[GPBInt32DoubleDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt32DoubleDictionary *dict = [GPBInt32DoubleDictionary dictionary];
+ GPBInt32DoubleDictionary *dict = [[GPBInt32DoubleDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2441,6 +2459,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getDouble:&value forKey:14]);
XCTAssertEqual(value, 603.);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -2602,7 +2621,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32EnumDictionary *dict = [GPBInt32EnumDictionary dictionaryWithEnum:700 forKey:11];
+ GPBInt32EnumDictionary *dict = [[GPBInt32EnumDictionary alloc] init];
+ [dict setEnum:700 forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -2615,6 +2635,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 700);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2757,17 +2778,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32EnumDictionary *dict2 =
- [GPBInt32EnumDictionary dictionaryWithDictionary:dict];
+ [[GPBInt32EnumDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt32EnumDictionary *dict = [GPBInt32EnumDictionary dictionary];
+ GPBInt32EnumDictionary *dict = [[GPBInt32EnumDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2798,6 +2820,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getEnum:&value forKey:14]);
XCTAssertEqual(value, 703);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -3120,19 +3143,20 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32EnumDictionary *dict2 =
- [GPBInt32EnumDictionary dictionaryWithDictionary:dict];
+ [[GPBInt32EnumDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
XCTAssertEqual(dict.validationFunc, dict2.validationFunc); // Pointer comparison
+ [dict2 release];
[dict release];
}
- (void)testUnknownAdds {
GPBInt32EnumDictionary *dict =
- [GPBInt32EnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue];
+ [[GPBInt32EnumDictionary alloc] initWithValidationFunction:TestingEnum_IsValidValue];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3172,6 +3196,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getRawValue:&value forKey:14]);
XCTAssertEqual(value, 803);
[dict2 release];
+ [dict release];
}
- (void)testUnknownRemove {
@@ -3375,7 +3400,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt32ObjectDictionary<NSString*> *dict = [GPBInt32ObjectDictionary dictionaryWithObject:@"abc" forKey:11];
+ GPBInt32ObjectDictionary<NSString*> *dict = [[GPBInt32ObjectDictionary alloc] init];
+ [dict setObject:@"abc" forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
XCTAssertEqualObjects([dict objectForKey:11], @"abc");
@@ -3385,6 +3411,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -3520,17 +3547,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt32ObjectDictionary<NSString*> *dict2 =
- [GPBInt32ObjectDictionary dictionaryWithDictionary:dict];
+ [[GPBInt32ObjectDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt32ObjectDictionary<NSString*> *dict = [GPBInt32ObjectDictionary dictionary];
+ GPBInt32ObjectDictionary<NSString*> *dict = [[GPBInt32ObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3552,6 +3580,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
XCTAssertEqualObjects([dict objectForKey:14], @"jkl");
[dict2 release];
+ [dict release];
}
- (void)testRemove {
diff --git a/objectivec/Tests/GPBDictionaryTests+Int64.m b/objectivec/Tests/GPBDictionaryTests+Int64.m
index b90cdf8c..966024b7 100644
--- a/objectivec/Tests/GPBDictionaryTests+Int64.m
+++ b/objectivec/Tests/GPBDictionaryTests+Int64.m
@@ -45,7 +45,6 @@
// To let the testing macros work, add some extra methods to simplify things.
@interface GPBInt64EnumDictionary (TestingTweak)
-+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(int64_t)key;
- (instancetype)initWithEnums:(const int32_t [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count;
@@ -64,14 +63,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
@implementation GPBInt64EnumDictionary (TestingTweak)
-+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(int64_t)key {
- // Cast is needed to compiler knows what class we are invoking initWithValues: on to get the
- // type correct.
- return [[(GPBInt64EnumDictionary*)[self alloc] initWithValidationFunction:TestingEnum_IsValidValue
- rawValues:&value
- forKeys:&key
- count:1] autorelease];
-}
- (instancetype)initWithEnums:(const int32_t [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count {
@@ -103,7 +94,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64UInt32Dictionary *dict = [GPBInt64UInt32Dictionary dictionaryWithUInt32:100U forKey:21LL];
+ GPBInt64UInt32Dictionary *dict = [[GPBInt64UInt32Dictionary alloc] init];
+ [dict setUInt32:100U forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint32_t value;
@@ -116,6 +108,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 100U);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -258,17 +251,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64UInt32Dictionary *dict2 =
- [GPBInt64UInt32Dictionary dictionaryWithDictionary:dict];
+ [[GPBInt64UInt32Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt64UInt32Dictionary *dict = [GPBInt64UInt32Dictionary dictionary];
+ GPBInt64UInt32Dictionary *dict = [[GPBInt64UInt32Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -299,6 +293,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt32:&value forKey:24LL]);
XCTAssertEqual(value, 103U);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -460,7 +455,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64Int32Dictionary *dict = [GPBInt64Int32Dictionary dictionaryWithInt32:200 forKey:21LL];
+ GPBInt64Int32Dictionary *dict = [[GPBInt64Int32Dictionary alloc] init];
+ [dict setInt32:200 forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -473,6 +469,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 200);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -615,17 +612,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64Int32Dictionary *dict2 =
- [GPBInt64Int32Dictionary dictionaryWithDictionary:dict];
+ [[GPBInt64Int32Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt64Int32Dictionary *dict = [GPBInt64Int32Dictionary dictionary];
+ GPBInt64Int32Dictionary *dict = [[GPBInt64Int32Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -656,6 +654,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt32:&value forKey:24LL]);
XCTAssertEqual(value, 203);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -817,7 +816,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64UInt64Dictionary *dict = [GPBInt64UInt64Dictionary dictionaryWithUInt64:300U forKey:21LL];
+ GPBInt64UInt64Dictionary *dict = [[GPBInt64UInt64Dictionary alloc] init];
+ [dict setUInt64:300U forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint64_t value;
@@ -830,6 +830,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 300U);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -972,17 +973,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64UInt64Dictionary *dict2 =
- [GPBInt64UInt64Dictionary dictionaryWithDictionary:dict];
+ [[GPBInt64UInt64Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt64UInt64Dictionary *dict = [GPBInt64UInt64Dictionary dictionary];
+ GPBInt64UInt64Dictionary *dict = [[GPBInt64UInt64Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1013,6 +1015,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt64:&value forKey:24LL]);
XCTAssertEqual(value, 303U);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1174,7 +1177,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64Int64Dictionary *dict = [GPBInt64Int64Dictionary dictionaryWithInt64:400 forKey:21LL];
+ GPBInt64Int64Dictionary *dict = [[GPBInt64Int64Dictionary alloc] init];
+ [dict setInt64:400 forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int64_t value;
@@ -1187,6 +1191,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 400);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -1329,17 +1334,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64Int64Dictionary *dict2 =
- [GPBInt64Int64Dictionary dictionaryWithDictionary:dict];
+ [[GPBInt64Int64Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt64Int64Dictionary *dict = [GPBInt64Int64Dictionary dictionary];
+ GPBInt64Int64Dictionary *dict = [[GPBInt64Int64Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1370,6 +1376,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt64:&value forKey:24LL]);
XCTAssertEqual(value, 403);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1531,7 +1538,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64BoolDictionary *dict = [GPBInt64BoolDictionary dictionaryWithBool:YES forKey:21LL];
+ GPBInt64BoolDictionary *dict = [[GPBInt64BoolDictionary alloc] init];
+ [dict setBool:YES forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
BOOL value;
@@ -1544,6 +1552,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, YES);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -1686,17 +1695,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64BoolDictionary *dict2 =
- [GPBInt64BoolDictionary dictionaryWithDictionary:dict];
+ [[GPBInt64BoolDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt64BoolDictionary *dict = [GPBInt64BoolDictionary dictionary];
+ GPBInt64BoolDictionary *dict = [[GPBInt64BoolDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1727,6 +1737,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getBool:&value forKey:24LL]);
XCTAssertEqual(value, NO);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1888,7 +1899,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64FloatDictionary *dict = [GPBInt64FloatDictionary dictionaryWithFloat:500.f forKey:21LL];
+ GPBInt64FloatDictionary *dict = [[GPBInt64FloatDictionary alloc] init];
+ [dict setFloat:500.f forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
float value;
@@ -1901,6 +1913,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 500.f);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2043,17 +2056,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64FloatDictionary *dict2 =
- [GPBInt64FloatDictionary dictionaryWithDictionary:dict];
+ [[GPBInt64FloatDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt64FloatDictionary *dict = [GPBInt64FloatDictionary dictionary];
+ GPBInt64FloatDictionary *dict = [[GPBInt64FloatDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2084,6 +2098,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getFloat:&value forKey:24LL]);
XCTAssertEqual(value, 503.f);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -2245,7 +2260,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64DoubleDictionary *dict = [GPBInt64DoubleDictionary dictionaryWithDouble:600. forKey:21LL];
+ GPBInt64DoubleDictionary *dict = [[GPBInt64DoubleDictionary alloc] init];
+ [dict setDouble:600. forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
double value;
@@ -2258,6 +2274,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 600.);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2400,17 +2417,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64DoubleDictionary *dict2 =
- [GPBInt64DoubleDictionary dictionaryWithDictionary:dict];
+ [[GPBInt64DoubleDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt64DoubleDictionary *dict = [GPBInt64DoubleDictionary dictionary];
+ GPBInt64DoubleDictionary *dict = [[GPBInt64DoubleDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2441,6 +2459,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getDouble:&value forKey:24LL]);
XCTAssertEqual(value, 603.);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -2602,7 +2621,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64EnumDictionary *dict = [GPBInt64EnumDictionary dictionaryWithEnum:700 forKey:21LL];
+ GPBInt64EnumDictionary *dict = [[GPBInt64EnumDictionary alloc] init];
+ [dict setEnum:700 forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -2615,6 +2635,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 700);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2757,17 +2778,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64EnumDictionary *dict2 =
- [GPBInt64EnumDictionary dictionaryWithDictionary:dict];
+ [[GPBInt64EnumDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt64EnumDictionary *dict = [GPBInt64EnumDictionary dictionary];
+ GPBInt64EnumDictionary *dict = [[GPBInt64EnumDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2798,6 +2820,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getEnum:&value forKey:24LL]);
XCTAssertEqual(value, 703);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -3120,19 +3143,20 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64EnumDictionary *dict2 =
- [GPBInt64EnumDictionary dictionaryWithDictionary:dict];
+ [[GPBInt64EnumDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
XCTAssertEqual(dict.validationFunc, dict2.validationFunc); // Pointer comparison
+ [dict2 release];
[dict release];
}
- (void)testUnknownAdds {
GPBInt64EnumDictionary *dict =
- [GPBInt64EnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue];
+ [[GPBInt64EnumDictionary alloc] initWithValidationFunction:TestingEnum_IsValidValue];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3172,6 +3196,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getRawValue:&value forKey:24LL]);
XCTAssertEqual(value, 803);
[dict2 release];
+ [dict release];
}
- (void)testUnknownRemove {
@@ -3375,7 +3400,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBInt64ObjectDictionary<NSString*> *dict = [GPBInt64ObjectDictionary dictionaryWithObject:@"abc" forKey:21LL];
+ GPBInt64ObjectDictionary<NSString*> *dict = [[GPBInt64ObjectDictionary alloc] init];
+ [dict setObject:@"abc" forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
@@ -3385,6 +3411,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -3520,17 +3547,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBInt64ObjectDictionary<NSString*> *dict2 =
- [GPBInt64ObjectDictionary dictionaryWithDictionary:dict];
+ [[GPBInt64ObjectDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBInt64ObjectDictionary<NSString*> *dict = [GPBInt64ObjectDictionary dictionary];
+ GPBInt64ObjectDictionary<NSString*> *dict = [[GPBInt64ObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3552,6 +3580,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
XCTAssertEqualObjects([dict objectForKey:24LL], @"jkl");
[dict2 release];
+ [dict release];
}
- (void)testRemove {
diff --git a/objectivec/Tests/GPBDictionaryTests+String.m b/objectivec/Tests/GPBDictionaryTests+String.m
index 5df1d51d..82d7952b 100644
--- a/objectivec/Tests/GPBDictionaryTests+String.m
+++ b/objectivec/Tests/GPBDictionaryTests+String.m
@@ -45,7 +45,6 @@
// To let the testing macros work, add some extra methods to simplify things.
@interface GPBStringEnumDictionary (TestingTweak)
-+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(NSString *)key;
- (instancetype)initWithEnums:(const int32_t [])values
forKeys:(const NSString * [])keys
count:(NSUInteger)count;
@@ -64,14 +63,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
@implementation GPBStringEnumDictionary (TestingTweak)
-+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(NSString *)key {
- // Cast is needed to compiler knows what class we are invoking initWithValues: on to get the
- // type correct.
- return [[(GPBStringEnumDictionary*)[self alloc] initWithValidationFunction:TestingEnum_IsValidValue
- rawValues:&value
- forKeys:&key
- count:1] autorelease];
-}
- (instancetype)initWithEnums:(const int32_t [])values
forKeys:(const NSString * [])keys
count:(NSUInteger)count {
@@ -103,7 +94,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringUInt32Dictionary *dict = [GPBStringUInt32Dictionary dictionaryWithUInt32:100U forKey:@"foo"];
+ GPBStringUInt32Dictionary *dict = [[GPBStringUInt32Dictionary alloc] init];
+ [dict setUInt32:100U forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint32_t value;
@@ -116,6 +108,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 100U);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -258,17 +251,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringUInt32Dictionary *dict2 =
- [GPBStringUInt32Dictionary dictionaryWithDictionary:dict];
+ [[GPBStringUInt32Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBStringUInt32Dictionary *dict = [GPBStringUInt32Dictionary dictionary];
+ GPBStringUInt32Dictionary *dict = [[GPBStringUInt32Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -299,6 +293,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt32:&value forKey:@"mumble"]);
XCTAssertEqual(value, 103U);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -460,7 +455,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringInt32Dictionary *dict = [GPBStringInt32Dictionary dictionaryWithInt32:200 forKey:@"foo"];
+ GPBStringInt32Dictionary *dict = [[GPBStringInt32Dictionary alloc] init];
+ [dict setInt32:200 forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -473,6 +469,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 200);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -615,17 +612,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringInt32Dictionary *dict2 =
- [GPBStringInt32Dictionary dictionaryWithDictionary:dict];
+ [[GPBStringInt32Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBStringInt32Dictionary *dict = [GPBStringInt32Dictionary dictionary];
+ GPBStringInt32Dictionary *dict = [[GPBStringInt32Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -656,6 +654,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt32:&value forKey:@"mumble"]);
XCTAssertEqual(value, 203);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -817,7 +816,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringUInt64Dictionary *dict = [GPBStringUInt64Dictionary dictionaryWithUInt64:300U forKey:@"foo"];
+ GPBStringUInt64Dictionary *dict = [[GPBStringUInt64Dictionary alloc] init];
+ [dict setUInt64:300U forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint64_t value;
@@ -830,6 +830,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 300U);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -972,17 +973,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringUInt64Dictionary *dict2 =
- [GPBStringUInt64Dictionary dictionaryWithDictionary:dict];
+ [[GPBStringUInt64Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBStringUInt64Dictionary *dict = [GPBStringUInt64Dictionary dictionary];
+ GPBStringUInt64Dictionary *dict = [[GPBStringUInt64Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1013,6 +1015,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt64:&value forKey:@"mumble"]);
XCTAssertEqual(value, 303U);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1174,7 +1177,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringInt64Dictionary *dict = [GPBStringInt64Dictionary dictionaryWithInt64:400 forKey:@"foo"];
+ GPBStringInt64Dictionary *dict = [[GPBStringInt64Dictionary alloc] init];
+ [dict setInt64:400 forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int64_t value;
@@ -1187,6 +1191,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 400);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -1329,17 +1334,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringInt64Dictionary *dict2 =
- [GPBStringInt64Dictionary dictionaryWithDictionary:dict];
+ [[GPBStringInt64Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBStringInt64Dictionary *dict = [GPBStringInt64Dictionary dictionary];
+ GPBStringInt64Dictionary *dict = [[GPBStringInt64Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1370,6 +1376,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt64:&value forKey:@"mumble"]);
XCTAssertEqual(value, 403);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1531,7 +1538,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringBoolDictionary *dict = [GPBStringBoolDictionary dictionaryWithBool:YES forKey:@"foo"];
+ GPBStringBoolDictionary *dict = [[GPBStringBoolDictionary alloc] init];
+ [dict setBool:YES forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
BOOL value;
@@ -1544,6 +1552,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, YES);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -1686,17 +1695,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringBoolDictionary *dict2 =
- [GPBStringBoolDictionary dictionaryWithDictionary:dict];
+ [[GPBStringBoolDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBStringBoolDictionary *dict = [GPBStringBoolDictionary dictionary];
+ GPBStringBoolDictionary *dict = [[GPBStringBoolDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1727,6 +1737,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getBool:&value forKey:@"mumble"]);
XCTAssertEqual(value, NO);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1888,7 +1899,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringFloatDictionary *dict = [GPBStringFloatDictionary dictionaryWithFloat:500.f forKey:@"foo"];
+ GPBStringFloatDictionary *dict = [[GPBStringFloatDictionary alloc] init];
+ [dict setFloat:500.f forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
float value;
@@ -1901,6 +1913,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 500.f);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2043,17 +2056,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringFloatDictionary *dict2 =
- [GPBStringFloatDictionary dictionaryWithDictionary:dict];
+ [[GPBStringFloatDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBStringFloatDictionary *dict = [GPBStringFloatDictionary dictionary];
+ GPBStringFloatDictionary *dict = [[GPBStringFloatDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2084,6 +2098,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getFloat:&value forKey:@"mumble"]);
XCTAssertEqual(value, 503.f);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -2245,7 +2260,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringDoubleDictionary *dict = [GPBStringDoubleDictionary dictionaryWithDouble:600. forKey:@"foo"];
+ GPBStringDoubleDictionary *dict = [[GPBStringDoubleDictionary alloc] init];
+ [dict setDouble:600. forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
double value;
@@ -2258,6 +2274,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 600.);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2400,17 +2417,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringDoubleDictionary *dict2 =
- [GPBStringDoubleDictionary dictionaryWithDictionary:dict];
+ [[GPBStringDoubleDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBStringDoubleDictionary *dict = [GPBStringDoubleDictionary dictionary];
+ GPBStringDoubleDictionary *dict = [[GPBStringDoubleDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2441,6 +2459,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getDouble:&value forKey:@"mumble"]);
XCTAssertEqual(value, 603.);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -2602,7 +2621,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBStringEnumDictionary *dict = [GPBStringEnumDictionary dictionaryWithEnum:700 forKey:@"foo"];
+ GPBStringEnumDictionary *dict = [[GPBStringEnumDictionary alloc] init];
+ [dict setEnum:700 forKey:@"foo"];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -2615,6 +2635,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 700);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2757,17 +2778,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringEnumDictionary *dict2 =
- [GPBStringEnumDictionary dictionaryWithDictionary:dict];
+ [[GPBStringEnumDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBStringEnumDictionary *dict = [GPBStringEnumDictionary dictionary];
+ GPBStringEnumDictionary *dict = [[GPBStringEnumDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2798,6 +2820,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getEnum:&value forKey:@"mumble"]);
XCTAssertEqual(value, 703);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -3120,19 +3143,20 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBStringEnumDictionary *dict2 =
- [GPBStringEnumDictionary dictionaryWithDictionary:dict];
+ [[GPBStringEnumDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
XCTAssertEqual(dict.validationFunc, dict2.validationFunc); // Pointer comparison
+ [dict2 release];
[dict release];
}
- (void)testUnknownAdds {
GPBStringEnumDictionary *dict =
- [GPBStringEnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue];
+ [[GPBStringEnumDictionary alloc] initWithValidationFunction:TestingEnum_IsValidValue];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3172,6 +3196,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getRawValue:&value forKey:@"mumble"]);
XCTAssertEqual(value, 803);
[dict2 release];
+ [dict release];
}
- (void)testUnknownRemove {
diff --git a/objectivec/Tests/GPBDictionaryTests+UInt32.m b/objectivec/Tests/GPBDictionaryTests+UInt32.m
index 1d3f6f78..5314c58a 100644
--- a/objectivec/Tests/GPBDictionaryTests+UInt32.m
+++ b/objectivec/Tests/GPBDictionaryTests+UInt32.m
@@ -45,7 +45,6 @@
// To let the testing macros work, add some extra methods to simplify things.
@interface GPBUInt32EnumDictionary (TestingTweak)
-+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(uint32_t)key;
- (instancetype)initWithEnums:(const int32_t [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count;
@@ -64,14 +63,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
@implementation GPBUInt32EnumDictionary (TestingTweak)
-+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(uint32_t)key {
- // Cast is needed to compiler knows what class we are invoking initWithValues: on to get the
- // type correct.
- return [[(GPBUInt32EnumDictionary*)[self alloc] initWithValidationFunction:TestingEnum_IsValidValue
- rawValues:&value
- forKeys:&key
- count:1] autorelease];
-}
- (instancetype)initWithEnums:(const int32_t [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count {
@@ -103,7 +94,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32UInt32Dictionary *dict = [GPBUInt32UInt32Dictionary dictionaryWithUInt32:100U forKey:1U];
+ GPBUInt32UInt32Dictionary *dict = [[GPBUInt32UInt32Dictionary alloc] init];
+ [dict setUInt32:100U forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint32_t value;
@@ -116,6 +108,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 100U);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -258,17 +251,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32UInt32Dictionary *dict2 =
- [GPBUInt32UInt32Dictionary dictionaryWithDictionary:dict];
+ [[GPBUInt32UInt32Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt32UInt32Dictionary *dict = [GPBUInt32UInt32Dictionary dictionary];
+ GPBUInt32UInt32Dictionary *dict = [[GPBUInt32UInt32Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -299,6 +293,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt32:&value forKey:4U]);
XCTAssertEqual(value, 103U);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -460,7 +455,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32Int32Dictionary *dict = [GPBUInt32Int32Dictionary dictionaryWithInt32:200 forKey:1U];
+ GPBUInt32Int32Dictionary *dict = [[GPBUInt32Int32Dictionary alloc] init];
+ [dict setInt32:200 forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -473,6 +469,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 200);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -615,17 +612,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32Int32Dictionary *dict2 =
- [GPBUInt32Int32Dictionary dictionaryWithDictionary:dict];
+ [[GPBUInt32Int32Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt32Int32Dictionary *dict = [GPBUInt32Int32Dictionary dictionary];
+ GPBUInt32Int32Dictionary *dict = [[GPBUInt32Int32Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -656,6 +654,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt32:&value forKey:4U]);
XCTAssertEqual(value, 203);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -817,7 +816,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32UInt64Dictionary *dict = [GPBUInt32UInt64Dictionary dictionaryWithUInt64:300U forKey:1U];
+ GPBUInt32UInt64Dictionary *dict = [[GPBUInt32UInt64Dictionary alloc] init];
+ [dict setUInt64:300U forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint64_t value;
@@ -830,6 +830,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 300U);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -972,17 +973,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32UInt64Dictionary *dict2 =
- [GPBUInt32UInt64Dictionary dictionaryWithDictionary:dict];
+ [[GPBUInt32UInt64Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt32UInt64Dictionary *dict = [GPBUInt32UInt64Dictionary dictionary];
+ GPBUInt32UInt64Dictionary *dict = [[GPBUInt32UInt64Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1013,6 +1015,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt64:&value forKey:4U]);
XCTAssertEqual(value, 303U);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1174,7 +1177,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32Int64Dictionary *dict = [GPBUInt32Int64Dictionary dictionaryWithInt64:400 forKey:1U];
+ GPBUInt32Int64Dictionary *dict = [[GPBUInt32Int64Dictionary alloc] init];
+ [dict setInt64:400 forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int64_t value;
@@ -1187,6 +1191,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 400);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -1329,17 +1334,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32Int64Dictionary *dict2 =
- [GPBUInt32Int64Dictionary dictionaryWithDictionary:dict];
+ [[GPBUInt32Int64Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt32Int64Dictionary *dict = [GPBUInt32Int64Dictionary dictionary];
+ GPBUInt32Int64Dictionary *dict = [[GPBUInt32Int64Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1370,6 +1376,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt64:&value forKey:4U]);
XCTAssertEqual(value, 403);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1531,7 +1538,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32BoolDictionary *dict = [GPBUInt32BoolDictionary dictionaryWithBool:YES forKey:1U];
+ GPBUInt32BoolDictionary *dict = [[GPBUInt32BoolDictionary alloc] init];
+ [dict setBool:YES forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
BOOL value;
@@ -1544,6 +1552,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, YES);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -1686,17 +1695,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32BoolDictionary *dict2 =
- [GPBUInt32BoolDictionary dictionaryWithDictionary:dict];
+ [[GPBUInt32BoolDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt32BoolDictionary *dict = [GPBUInt32BoolDictionary dictionary];
+ GPBUInt32BoolDictionary *dict = [[GPBUInt32BoolDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1727,6 +1737,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getBool:&value forKey:4U]);
XCTAssertEqual(value, NO);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1888,7 +1899,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32FloatDictionary *dict = [GPBUInt32FloatDictionary dictionaryWithFloat:500.f forKey:1U];
+ GPBUInt32FloatDictionary *dict = [[GPBUInt32FloatDictionary alloc] init];
+ [dict setFloat:500.f forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
float value;
@@ -1901,6 +1913,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 500.f);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2043,17 +2056,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32FloatDictionary *dict2 =
- [GPBUInt32FloatDictionary dictionaryWithDictionary:dict];
+ [[GPBUInt32FloatDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt32FloatDictionary *dict = [GPBUInt32FloatDictionary dictionary];
+ GPBUInt32FloatDictionary *dict = [[GPBUInt32FloatDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2084,6 +2098,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getFloat:&value forKey:4U]);
XCTAssertEqual(value, 503.f);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -2245,7 +2260,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32DoubleDictionary *dict = [GPBUInt32DoubleDictionary dictionaryWithDouble:600. forKey:1U];
+ GPBUInt32DoubleDictionary *dict = [[GPBUInt32DoubleDictionary alloc] init];
+ [dict setDouble:600. forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
double value;
@@ -2258,6 +2274,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 600.);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2400,17 +2417,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32DoubleDictionary *dict2 =
- [GPBUInt32DoubleDictionary dictionaryWithDictionary:dict];
+ [[GPBUInt32DoubleDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt32DoubleDictionary *dict = [GPBUInt32DoubleDictionary dictionary];
+ GPBUInt32DoubleDictionary *dict = [[GPBUInt32DoubleDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2441,6 +2459,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getDouble:&value forKey:4U]);
XCTAssertEqual(value, 603.);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -2602,7 +2621,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32EnumDictionary *dict = [GPBUInt32EnumDictionary dictionaryWithEnum:700 forKey:1U];
+ GPBUInt32EnumDictionary *dict = [[GPBUInt32EnumDictionary alloc] init];
+ [dict setEnum:700 forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -2615,6 +2635,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 700);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2757,17 +2778,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32EnumDictionary *dict2 =
- [GPBUInt32EnumDictionary dictionaryWithDictionary:dict];
+ [[GPBUInt32EnumDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt32EnumDictionary *dict = [GPBUInt32EnumDictionary dictionary];
+ GPBUInt32EnumDictionary *dict = [[GPBUInt32EnumDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2798,6 +2820,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getEnum:&value forKey:4U]);
XCTAssertEqual(value, 703);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -3120,19 +3143,20 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32EnumDictionary *dict2 =
- [GPBUInt32EnumDictionary dictionaryWithDictionary:dict];
+ [[GPBUInt32EnumDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
XCTAssertEqual(dict.validationFunc, dict2.validationFunc); // Pointer comparison
+ [dict2 release];
[dict release];
}
- (void)testUnknownAdds {
GPBUInt32EnumDictionary *dict =
- [GPBUInt32EnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue];
+ [[GPBUInt32EnumDictionary alloc] initWithValidationFunction:TestingEnum_IsValidValue];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3172,6 +3196,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getRawValue:&value forKey:4U]);
XCTAssertEqual(value, 803);
[dict2 release];
+ [dict release];
}
- (void)testUnknownRemove {
@@ -3375,7 +3400,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt32ObjectDictionary<NSString*> *dict = [GPBUInt32ObjectDictionary dictionaryWithObject:@"abc" forKey:1U];
+ GPBUInt32ObjectDictionary<NSString*> *dict = [[GPBUInt32ObjectDictionary alloc] init];
+ [dict setObject:@"abc" forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
@@ -3385,6 +3411,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -3520,17 +3547,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt32ObjectDictionary<NSString*> *dict2 =
- [GPBUInt32ObjectDictionary dictionaryWithDictionary:dict];
+ [[GPBUInt32ObjectDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt32ObjectDictionary<NSString*> *dict = [GPBUInt32ObjectDictionary dictionary];
+ GPBUInt32ObjectDictionary<NSString*> *dict = [[GPBUInt32ObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3552,6 +3580,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
XCTAssertEqualObjects([dict objectForKey:4U], @"jkl");
[dict2 release];
+ [dict release];
}
- (void)testRemove {
diff --git a/objectivec/Tests/GPBDictionaryTests+UInt64.m b/objectivec/Tests/GPBDictionaryTests+UInt64.m
index 94c116f6..ccd063f5 100644
--- a/objectivec/Tests/GPBDictionaryTests+UInt64.m
+++ b/objectivec/Tests/GPBDictionaryTests+UInt64.m
@@ -45,7 +45,6 @@
// To let the testing macros work, add some extra methods to simplify things.
@interface GPBUInt64EnumDictionary (TestingTweak)
-+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(uint64_t)key;
- (instancetype)initWithEnums:(const int32_t [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count;
@@ -64,14 +63,6 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
@implementation GPBUInt64EnumDictionary (TestingTweak)
-+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(uint64_t)key {
- // Cast is needed to compiler knows what class we are invoking initWithValues: on to get the
- // type correct.
- return [[(GPBUInt64EnumDictionary*)[self alloc] initWithValidationFunction:TestingEnum_IsValidValue
- rawValues:&value
- forKeys:&key
- count:1] autorelease];
-}
- (instancetype)initWithEnums:(const int32_t [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count {
@@ -103,7 +94,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64UInt32Dictionary *dict = [GPBUInt64UInt32Dictionary dictionaryWithUInt32:100U forKey:31ULL];
+ GPBUInt64UInt32Dictionary *dict = [[GPBUInt64UInt32Dictionary alloc] init];
+ [dict setUInt32:100U forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint32_t value;
@@ -116,6 +108,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 100U);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -258,17 +251,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64UInt32Dictionary *dict2 =
- [GPBUInt64UInt32Dictionary dictionaryWithDictionary:dict];
+ [[GPBUInt64UInt32Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt64UInt32Dictionary *dict = [GPBUInt64UInt32Dictionary dictionary];
+ GPBUInt64UInt32Dictionary *dict = [[GPBUInt64UInt32Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -299,6 +293,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt32:&value forKey:34ULL]);
XCTAssertEqual(value, 103U);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -460,7 +455,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64Int32Dictionary *dict = [GPBUInt64Int32Dictionary dictionaryWithInt32:200 forKey:31ULL];
+ GPBUInt64Int32Dictionary *dict = [[GPBUInt64Int32Dictionary alloc] init];
+ [dict setInt32:200 forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -473,6 +469,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 200);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -615,17 +612,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64Int32Dictionary *dict2 =
- [GPBUInt64Int32Dictionary dictionaryWithDictionary:dict];
+ [[GPBUInt64Int32Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt64Int32Dictionary *dict = [GPBUInt64Int32Dictionary dictionary];
+ GPBUInt64Int32Dictionary *dict = [[GPBUInt64Int32Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -656,6 +654,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt32:&value forKey:34ULL]);
XCTAssertEqual(value, 203);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -817,7 +816,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64UInt64Dictionary *dict = [GPBUInt64UInt64Dictionary dictionaryWithUInt64:300U forKey:31ULL];
+ GPBUInt64UInt64Dictionary *dict = [[GPBUInt64UInt64Dictionary alloc] init];
+ [dict setUInt64:300U forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
uint64_t value;
@@ -830,6 +830,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 300U);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -972,17 +973,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64UInt64Dictionary *dict2 =
- [GPBUInt64UInt64Dictionary dictionaryWithDictionary:dict];
+ [[GPBUInt64UInt64Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt64UInt64Dictionary *dict = [GPBUInt64UInt64Dictionary dictionary];
+ GPBUInt64UInt64Dictionary *dict = [[GPBUInt64UInt64Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1013,6 +1015,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getUInt64:&value forKey:34ULL]);
XCTAssertEqual(value, 303U);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1174,7 +1177,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64Int64Dictionary *dict = [GPBUInt64Int64Dictionary dictionaryWithInt64:400 forKey:31ULL];
+ GPBUInt64Int64Dictionary *dict = [[GPBUInt64Int64Dictionary alloc] init];
+ [dict setInt64:400 forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int64_t value;
@@ -1187,6 +1191,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 400);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -1329,17 +1334,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64Int64Dictionary *dict2 =
- [GPBUInt64Int64Dictionary dictionaryWithDictionary:dict];
+ [[GPBUInt64Int64Dictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt64Int64Dictionary *dict = [GPBUInt64Int64Dictionary dictionary];
+ GPBUInt64Int64Dictionary *dict = [[GPBUInt64Int64Dictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1370,6 +1376,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getInt64:&value forKey:34ULL]);
XCTAssertEqual(value, 403);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1531,7 +1538,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64BoolDictionary *dict = [GPBUInt64BoolDictionary dictionaryWithBool:YES forKey:31ULL];
+ GPBUInt64BoolDictionary *dict = [[GPBUInt64BoolDictionary alloc] init];
+ [dict setBool:YES forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
BOOL value;
@@ -1544,6 +1552,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, YES);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -1686,17 +1695,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64BoolDictionary *dict2 =
- [GPBUInt64BoolDictionary dictionaryWithDictionary:dict];
+ [[GPBUInt64BoolDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt64BoolDictionary *dict = [GPBUInt64BoolDictionary dictionary];
+ GPBUInt64BoolDictionary *dict = [[GPBUInt64BoolDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -1727,6 +1737,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getBool:&value forKey:34ULL]);
XCTAssertEqual(value, NO);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -1888,7 +1899,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64FloatDictionary *dict = [GPBUInt64FloatDictionary dictionaryWithFloat:500.f forKey:31ULL];
+ GPBUInt64FloatDictionary *dict = [[GPBUInt64FloatDictionary alloc] init];
+ [dict setFloat:500.f forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
float value;
@@ -1901,6 +1913,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 500.f);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2043,17 +2056,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64FloatDictionary *dict2 =
- [GPBUInt64FloatDictionary dictionaryWithDictionary:dict];
+ [[GPBUInt64FloatDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt64FloatDictionary *dict = [GPBUInt64FloatDictionary dictionary];
+ GPBUInt64FloatDictionary *dict = [[GPBUInt64FloatDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2084,6 +2098,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getFloat:&value forKey:34ULL]);
XCTAssertEqual(value, 503.f);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -2245,7 +2260,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64DoubleDictionary *dict = [GPBUInt64DoubleDictionary dictionaryWithDouble:600. forKey:31ULL];
+ GPBUInt64DoubleDictionary *dict = [[GPBUInt64DoubleDictionary alloc] init];
+ [dict setDouble:600. forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
double value;
@@ -2258,6 +2274,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 600.);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2400,17 +2417,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64DoubleDictionary *dict2 =
- [GPBUInt64DoubleDictionary dictionaryWithDictionary:dict];
+ [[GPBUInt64DoubleDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt64DoubleDictionary *dict = [GPBUInt64DoubleDictionary dictionary];
+ GPBUInt64DoubleDictionary *dict = [[GPBUInt64DoubleDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2441,6 +2459,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getDouble:&value forKey:34ULL]);
XCTAssertEqual(value, 603.);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -2602,7 +2621,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64EnumDictionary *dict = [GPBUInt64EnumDictionary dictionaryWithEnum:700 forKey:31ULL];
+ GPBUInt64EnumDictionary *dict = [[GPBUInt64EnumDictionary alloc] init];
+ [dict setEnum:700 forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
int32_t value;
@@ -2615,6 +2635,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqual(aValue, 700);
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -2757,17 +2778,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64EnumDictionary *dict2 =
- [GPBUInt64EnumDictionary dictionaryWithDictionary:dict];
+ [[GPBUInt64EnumDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt64EnumDictionary *dict = [GPBUInt64EnumDictionary dictionary];
+ GPBUInt64EnumDictionary *dict = [[GPBUInt64EnumDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -2798,6 +2820,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getEnum:&value forKey:34ULL]);
XCTAssertEqual(value, 703);
[dict2 release];
+ [dict release];
}
- (void)testRemove {
@@ -3120,19 +3143,20 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64EnumDictionary *dict2 =
- [GPBUInt64EnumDictionary dictionaryWithDictionary:dict];
+ [[GPBUInt64EnumDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
XCTAssertEqual(dict.validationFunc, dict2.validationFunc); // Pointer comparison
+ [dict2 release];
[dict release];
}
- (void)testUnknownAdds {
GPBUInt64EnumDictionary *dict =
- [GPBUInt64EnumDictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue];
+ [[GPBUInt64EnumDictionary alloc] initWithValidationFunction:TestingEnum_IsValidValue];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3172,6 +3196,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertTrue([dict getRawValue:&value forKey:34ULL]);
XCTAssertEqual(value, 803);
[dict2 release];
+ [dict release];
}
- (void)testUnknownRemove {
@@ -3375,7 +3400,8 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
}
- (void)testOne {
- GPBUInt64ObjectDictionary<NSString*> *dict = [GPBUInt64ObjectDictionary dictionaryWithObject:@"abc" forKey:31ULL];
+ GPBUInt64ObjectDictionary<NSString*> *dict = [[GPBUInt64ObjectDictionary alloc] init];
+ [dict setObject:@"abc" forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
@@ -3385,6 +3411,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
+ [dict release];
}
- (void)testBasics {
@@ -3520,17 +3547,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
GPBUInt64ObjectDictionary<NSString*> *dict2 =
- [GPBUInt64ObjectDictionary dictionaryWithDictionary:dict];
+ [[GPBUInt64ObjectDictionary alloc] initWithDictionary:dict];
XCTAssertNotNil(dict2);
// Should be new pointer, but equal objects.
XCTAssertNotEqual(dict, dict2);
XCTAssertEqualObjects(dict, dict2);
+ [dict2 release];
[dict release];
}
- (void)testAdds {
- GPBUInt64ObjectDictionary<NSString*> *dict = [GPBUInt64ObjectDictionary dictionary];
+ GPBUInt64ObjectDictionary<NSString*> *dict = [[GPBUInt64ObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
@@ -3552,6 +3580,7 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
XCTAssertEqualObjects([dict objectForKey:34ULL], @"jkl");
[dict2 release];
+ [dict release];
}
- (void)testRemove {
diff --git a/objectivec/Tests/GPBDictionaryTests.pddm b/objectivec/Tests/GPBDictionaryTests.pddm
index d6aa7211..17f12c28 100644
--- a/objectivec/Tests/GPBDictionaryTests.pddm
+++ b/objectivec/Tests/GPBDictionaryTests.pddm
@@ -78,7 +78,8 @@
//%}
//%
//%- (void)testOne {
-//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWith##VALUE_NAME$u##:VAL1 forKey:KEY1];
+//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] init];
+//% [dict set##VALUE_NAME$u##:VAL1 forKey:KEY1];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 1U);
//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(VALUE_NAME, dict, VNAME, KEY1, VAL1)
@@ -88,6 +89,7 @@
//% XCTAssertEqual##VSUFFIX(a##VNAME$u, VAL1);
//% XCTAssertNotEqual(stop, NULL);
//% }];
+//% [dict release];
//%}
//%
//%- (void)testBasics {
@@ -223,17 +225,18 @@
//% XCTAssertNotNil(dict);
//%
//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict2 =
-//% [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithDictionary:dict];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithDictionary:dict];
//% XCTAssertNotNil(dict2);
//%
//% // Should be new pointer, but equal objects.
//% XCTAssertNotEqual(dict, dict2);
//% XCTAssertEqualObjects(dict, dict2);
+//% [dict2 release];
//% [dict release];
//%}
//%
//%- (void)testAdds {
-//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionary];
+//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] init];
//% XCTAssertNotNil(dict);
//%
//% XCTAssertEqual(dict.count, 0U);
@@ -255,6 +258,7 @@
//%TEST_VALUE##VHELPER(VALUE_NAME, dict, VNAME, KEY3, VAL3)
//%TEST_VALUE##VHELPER(VALUE_NAME, dict, VNAME, KEY4, VAL4)
//% [dict2 release];
+//% [dict release];
//%}
//%
//%- (void)testRemove {
@@ -522,19 +526,20 @@
//% XCTAssertNotNil(dict);
//%
//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict2 =
-//% [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithDictionary:dict];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithDictionary:dict];
//% XCTAssertNotNil(dict2);
//%
//% // Should be new pointer, but equal objects.
//% XCTAssertNotEqual(dict, dict2);
//% XCTAssertEqualObjects(dict, dict2);
//% XCTAssertEqual(dict.validationFunc, dict2.validationFunc); // Pointer comparison
+//% [dict2 release];
//% [dict release];
//%}
//%
//%- (void)testUnknownAdds {
//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict =
-//% [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithValidationFunction:TestingEnum_IsValidValue];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValidationFunction:TestingEnum_IsValidValue];
//% XCTAssertNotNil(dict);
//%
//% XCTAssertEqual(dict.count, 0U);
@@ -561,6 +566,7 @@
//%TEST_VALUE##VHELPER(VALUE_NAME, dict, value, KEY4, kGPBUnrecognizedEnumeratorValue)
//%TEST_RAW_VALUE##VHELPER(dict, value, KEY4, VAL4)
//% [dict2 release];
+//% [dict release];
//%}
//%
//%- (void)testUnknownRemove {
@@ -729,7 +735,6 @@
//%PDDM-DEFINE TEST_HELPERS(KEY_NAME, KEY_TYPE, KisP)
//%// To let the testing macros work, add some extra methods to simplify things.
//%@interface GPB##KEY_NAME##EnumDictionary (TestingTweak)
-//%+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(KEY_TYPE##KisP$S##KisP)key;
//%- (instancetype)initWithEnums:(const int32_t [])values
//% forKeys:(const KEY_TYPE##KisP$S##KisP [])keys
//% count:(NSUInteger)count;
@@ -748,14 +753,6 @@
//%}
//%
//%@implementation GPB##KEY_NAME##EnumDictionary (TestingTweak)
-//%+ (instancetype)dictionaryWithEnum:(int32_t)value forKey:(KEY_TYPE##KisP$S##KisP)key {
-//% // Cast is needed to compiler knows what class we are invoking initWithValues: on to get the
-//% // type correct.
-//% return [[(GPB##KEY_NAME##EnumDictionary*)[self alloc] initWithValidationFunction:TestingEnum_IsValidValue
-//% KEY_NAME$S rawValues:&value
-//% KEY_NAME$S forKeys:&key
-//% KEY_NAME$S count:1] autorelease];
-//%}
//%- (instancetype)initWithEnums:(const int32_t [])values
//% forKeys:(const KEY_TYPE##KisP$S##KisP [])keys
//% count:(NSUInteger)count {
@@ -801,7 +798,8 @@
//%}
//%
//%- (void)testOne {
-//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWith##VALUE_NAME$u##:VAL1 forKey:KEY1];
+//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] init];
+//% [dict set##VALUE_NAME$u##:VAL1 forKey:KEY1];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 1U);
//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(VALUE_NAME, dict, VNAME, KEY1, VAL1)
@@ -811,6 +809,7 @@
//% XCTAssertEqual##VSUFFIX(a##VNAME$u, VAL1);
//% XCTAssertNotEqual(stop, NULL);
//% }];
+//% [dict release];
//%}
//%
//%- (void)testBasics {
@@ -944,17 +943,18 @@
//% XCTAssertNotNil(dict);
//%
//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict2 =
-//% [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithDictionary:dict];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithDictionary:dict];
//% XCTAssertNotNil(dict2);
//%
//% // Should be new pointer, but equal objects.
//% XCTAssertNotEqual(dict, dict2);
//% XCTAssertEqualObjects(dict, dict2);
+//% [dict2 release];
//% [dict release];
//%}
//%
//%- (void)testAdds {
-//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionary];
+//% DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) *dict = [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] init];
//% XCTAssertNotNil(dict);
//%
//% XCTAssertEqual(dict.count, 0U);
@@ -974,6 +974,7 @@
//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(VALUE_NAME, dict, VNAME, KEY1, VAL1)
//%TEST_VALUE##VHELPER(VALUE_NAME, dict, VNAME, KEY2, VAL2)
//% [dict2 release];
+//% [dict release];
//%}
//%
//%- (void)testRemove {
diff --git a/objectivec/Tests/GPBMessageTests+Serialization.m b/objectivec/Tests/GPBMessageTests+Serialization.m
index 55d77a1f..921feab7 100644
--- a/objectivec/Tests/GPBMessageTests+Serialization.m
+++ b/objectivec/Tests/GPBMessageTests+Serialization.m
@@ -1114,10 +1114,10 @@
- (void)testMap_Proto2UnknownEnum {
TestEnumMapPlusExtra *orig = [[TestEnumMapPlusExtra alloc] init];
- orig.knownMapField = [GPBInt32EnumDictionary
- dictionaryWithValidationFunction:Proto2MapEnumPlusExtra_IsValidValue];
- orig.unknownMapField = [GPBInt32EnumDictionary
- dictionaryWithValidationFunction:Proto2MapEnumPlusExtra_IsValidValue];
+ orig.knownMapField = [[[GPBInt32EnumDictionary alloc]
+ initWithValidationFunction:Proto2MapEnumPlusExtra_IsValidValue] autorelease];
+ orig.unknownMapField = [[[GPBInt32EnumDictionary alloc]
+ initWithValidationFunction:Proto2MapEnumPlusExtra_IsValidValue] autorelease];
[orig.knownMapField setEnum:Proto2MapEnumPlusExtra_EProto2MapEnumFoo
forKey:0];
[orig.unknownMapField setEnum:Proto2MapEnumPlusExtra_EProto2MapEnumExtra
diff --git a/objectivec/Tests/GPBMessageTests.m b/objectivec/Tests/GPBMessageTests.m
index c15535c5..4d75f1e1 100644
--- a/objectivec/Tests/GPBMessageTests.m
+++ b/objectivec/Tests/GPBMessageTests.m
@@ -1238,7 +1238,8 @@
// with different objects that are equal).
TestRecursiveMessageWithRepeatedField *message3 =
[TestRecursiveMessageWithRepeatedField message];
- message3.iToI = [GPBInt32Int32Dictionary dictionaryWithInt32:10 forKey:20];
+ message3.iToI = [[[GPBInt32Int32Dictionary alloc] init] autorelease];
+ [message3.iToI setInt32:10 forKey:20];
message3.strToStr =
[NSMutableDictionary dictionaryWithObject:@"abc" forKey:@"123"];
XCTAssertNotNil(message.iToI);
@@ -1323,7 +1324,8 @@
XCTAssertFalse([message hasA]);
GPBInt32Int32Dictionary *iToI = [message.a.iToI retain];
XCTAssertEqual(iToI->_autocreator, message.a); // Pointer comparision
- message.a.iToI = [GPBInt32Int32Dictionary dictionaryWithInt32:6 forKey:7];
+ message.a.iToI = [[[GPBInt32Int32Dictionary alloc] init] autorelease];
+ [message.a.iToI setInt32:6 forKey:7];
XCTAssertTrue([message hasA]);
XCTAssertNotEqual(message.a.iToI, iToI); // Pointer comparision
XCTAssertNil(iToI->_autocreator);
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json
index 0cbf9acc..9f4a9e59 100644
--- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/Contents.json
@@ -1,72 +1,103 @@
{
"images" : [
{
+ "size" : "20x20",
"idiom" : "iphone",
+ "filename" : "appicon_40.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "appicon_60.png",
+ "scale" : "3x"
+ },
+ {
"size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "appicon_29.png",
"scale" : "1x"
},
{
- "idiom" : "iphone",
"size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "appicon_58.png",
"scale" : "2x"
},
{
- "idiom" : "iphone",
"size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "appicon_87.png",
"scale" : "3x"
},
{
- "idiom" : "iphone",
"size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "appicon_80.png",
"scale" : "2x"
},
{
- "idiom" : "iphone",
"size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "appicon_120.png",
"scale" : "3x"
},
{
- "size" : "57x57",
"idiom" : "iphone",
- "filename" : "iPhone6.png",
+ "size" : "57x57",
"scale" : "1x"
},
{
- "size" : "57x57",
"idiom" : "iphone",
- "filename" : "iPhone6_2x.png",
+ "size" : "57x57",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
- "filename" : "iPhone7_2x.png",
+ "filename" : "appicon_120.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
- "filename" : "iPhone7_3x.png",
+ "filename" : "appicon_180.png",
"scale" : "3x"
},
{
+ "size" : "20x20",
"idiom" : "ipad",
- "size" : "29x29",
+ "filename" : "appicon_20.png",
"scale" : "1x"
},
{
+ "size" : "20x20",
"idiom" : "ipad",
- "size" : "29x29",
+ "filename" : "appicon_40.png",
"scale" : "2x"
},
{
+ "size" : "29x29",
"idiom" : "ipad",
- "size" : "40x40",
+ "filename" : "appicon_29.png",
"scale" : "1x"
},
{
+ "size" : "29x29",
"idiom" : "ipad",
+ "filename" : "appicon_58.png",
+ "scale" : "2x"
+ },
+ {
"size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "appicon_40.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "appicon_80.png",
"scale" : "2x"
},
{
@@ -80,32 +111,37 @@
"scale" : "2x"
},
{
- "size" : "72x72",
"idiom" : "ipad",
- "filename" : "iPad6.png",
+ "size" : "72x72",
"scale" : "1x"
},
{
- "size" : "72x72",
"idiom" : "ipad",
- "filename" : "iPad6_2x.png",
+ "size" : "72x72",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
- "filename" : "iPad7.png",
+ "filename" : "appicon_76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
- "filename" : "iPad7_2x.png",
+ "filename" : "appicon_152.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "appicon_167.png",
"scale" : "2x"
},
{
- "idiom" : "car",
- "size" : "120x120",
+ "size" : "1024x1024",
+ "idiom" : "ios-marketing",
+ "filename" : "appicon_1024.png",
"scale" : "1x"
}
],
@@ -113,4 +149,4 @@
"version" : 1,
"author" : "xcode"
}
-}
+} \ No newline at end of file
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_1024.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_1024.png
new file mode 100644
index 00000000..6b6a102e
--- /dev/null
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_1024.png
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_120.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_120.png
new file mode 100644
index 00000000..1bac2e58
--- /dev/null
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_120.png
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_152.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_152.png
new file mode 100644
index 00000000..80f13301
--- /dev/null
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_152.png
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_167.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_167.png
new file mode 100644
index 00000000..99f0745e
--- /dev/null
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_167.png
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_180.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_180.png
new file mode 100644
index 00000000..ae123712
--- /dev/null
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_180.png
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_20.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_20.png
new file mode 100644
index 00000000..8e530c49
--- /dev/null
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_20.png
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_29.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_29.png
new file mode 100644
index 00000000..1826feb9
--- /dev/null
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_29.png
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_40.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_40.png
new file mode 100644
index 00000000..f2e2ded1
--- /dev/null
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_40.png
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_58.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_58.png
new file mode 100644
index 00000000..0ec6d003
--- /dev/null
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_58.png
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_60.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_60.png
new file mode 100644
index 00000000..8664e8b0
--- /dev/null
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_60.png
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_76.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_76.png
new file mode 100644
index 00000000..d4bb05b9
--- /dev/null
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_76.png
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_80.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_80.png
new file mode 100644
index 00000000..8fa6a8e7
--- /dev/null
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_80.png
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_87.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_87.png
new file mode 100644
index 00000000..b41bc67b
--- /dev/null
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/appicon_87.png
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.png
deleted file mode 100644
index 43da2ee4..00000000
--- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6.png
+++ /dev/null
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6_2x.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6_2x.png
deleted file mode 100644
index 2ec93704..00000000
--- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad6_2x.png
+++ /dev/null
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.png
deleted file mode 100644
index aec8bc1b..00000000
--- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7.png
+++ /dev/null
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7_2x.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7_2x.png
deleted file mode 100644
index e39cc3e7..00000000
--- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPad7_2x.png
+++ /dev/null
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.png
deleted file mode 100644
index 5572d79f..00000000
--- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6.png
+++ /dev/null
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6_2x.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6_2x.png
deleted file mode 100644
index 2424997f..00000000
--- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone6_2x.png
+++ /dev/null
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_2x.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_2x.png
deleted file mode 100644
index 10bfc3cf..00000000
--- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_2x.png
+++ /dev/null
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_3x.png b/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_3x.png
deleted file mode 100644
index 8d16f14d..00000000
--- a/objectivec/Tests/iOSTestHarness/Images.xcassets/AppIcon.appiconset/iPhone7_3x.png
+++ /dev/null
Binary files differ
diff --git a/objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json b/objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json
index 5a296668..a0ad363c 100644
--- a/objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json
+++ b/objectivec/Tests/iOSTestHarness/Images.xcassets/LaunchImage.launchimage/Contents.json
@@ -3,43 +3,30 @@
{
"orientation" : "portrait",
"idiom" : "ipad",
- "minimum-system-version" : "7.0",
"extent" : "full-screen",
- "scale" : "2x"
- },
- {
- "orientation" : "landscape",
- "idiom" : "ipad",
"minimum-system-version" : "7.0",
- "extent" : "full-screen",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
- "minimum-system-version" : "7.0",
"extent" : "full-screen",
- "scale" : "2x"
- },
- {
- "orientation" : "portrait",
- "idiom" : "iphone",
"minimum-system-version" : "7.0",
- "scale" : "2x"
+ "scale" : "1x"
},
{
"orientation" : "portrait",
- "idiom" : "iphone",
+ "idiom" : "ipad",
+ "extent" : "full-screen",
"minimum-system-version" : "7.0",
- "subtype" : "retina4",
"scale" : "2x"
},
{
- "orientation" : "portrait",
+ "orientation" : "landscape",
"idiom" : "ipad",
- "minimum-system-version" : "7.0",
"extent" : "full-screen",
- "scale" : "1x"
+ "minimum-system-version" : "7.0",
+ "scale" : "2x"
}
],
"info" : {
diff --git a/objectivec/google/protobuf/Any.pbobjc.h b/objectivec/google/protobuf/Any.pbobjc.h
index b17e76f0..89c99bdb 100644
--- a/objectivec/google/protobuf/Any.pbobjc.h
+++ b/objectivec/google/protobuf/Any.pbobjc.h
@@ -135,17 +135,18 @@ typedef GPB_ENUM(GPBAny_FieldNumber) {
@interface GPBAny : GPBMessage
/**
- * A URL/resource name whose content describes the type of the
- * serialized protocol buffer message.
+ * A URL/resource name that uniquely identifies the type of the serialized
+ * protocol buffer message. The last segment of the URL's path must represent
+ * the fully qualified name of the type (as in
+ * `path/google.protobuf.Duration`). The name should be in a canonical form
+ * (e.g., leading "." is not accepted).
*
- * For URLs which use the scheme `http`, `https`, or no scheme, the
- * following restrictions and interpretations apply:
+ * In practice, teams usually precompile into the binary all types that they
+ * expect it to use in the context of Any. However, for URLs which use the
+ * scheme `http`, `https`, or no scheme, one can optionally set up a type
+ * server that maps type URLs to message definitions as follows:
*
* * If no scheme is provided, `https` is assumed.
- * * The last segment of the URL's path must represent the fully
- * qualified name of the type (as in `path/google.protobuf.Duration`).
- * The name should be in a canonical form (e.g., leading "." is
- * not accepted).
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
* value in binary format, or produce an error.
* * Applications are allowed to cache lookup results based on the
@@ -154,6 +155,10 @@ typedef GPB_ENUM(GPBAny_FieldNumber) {
* on changes to types. (Use versioned type names to manage
* 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.
+ *
* Schemes other than `http`, `https` (or the empty scheme) might be
* used with implementation specific semantics.
**/
diff --git a/objectivec/google/protobuf/Timestamp.pbobjc.h b/objectivec/google/protobuf/Timestamp.pbobjc.h
index 0b670c35..7e65b15b 100644
--- a/objectivec/google/protobuf/Timestamp.pbobjc.h
+++ b/objectivec/google/protobuf/Timestamp.pbobjc.h
@@ -115,7 +115,9 @@ typedef GPB_ENUM(GPBTimestamp_FieldNumber) {
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
- * is required, though only UTC (as indicated by "Z") is presently supported.
+ * is required. A proto3 JSON serializer should always use UTC (as indicated by
+ * "Z") when printing the Timestamp type and a proto3 JSON parser should be
+ * able to accept both UTC and other timezones (as indicated by an offset).
*
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
* 01:30 UTC on January 15, 2017.
@@ -126,8 +128,8 @@ typedef GPB_ENUM(GPBTimestamp_FieldNumber) {
* to this format using [`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--)
- * to obtain a formatter capable of generating timestamps in this format.
+ * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
+ * ) to obtain a formatter capable of generating timestamps in this format.
**/
@interface GPBTimestamp : GPBMessage
diff --git a/php/README.md b/php/README.md
index cebeb3e5..da7884ea 100644
--- a/php/README.md
+++ b/php/README.md
@@ -16,7 +16,7 @@ generation functionality.
To use PHP runtime library requires:
-- C extension: PHP 5.5.x or 5.6.x.
+- C extension: PHP 5.5, 5.6, or 7.
- PHP package: PHP 5.5, 5.6 or 7.
## Installation
diff --git a/protobuf.bzl b/protobuf.bzl
index 23380bab..6aed44a4 100644
--- a/protobuf.bzl
+++ b/protobuf.bzl
@@ -400,3 +400,15 @@ def internal_protobuf_py_tests(
srcs=[s],
main=s,
**kargs)
+
+
+def check_protobuf_required_bazel_version():
+ """For WORKSPACE files, to check the installed version of bazel.
+
+ This ensures bazel supports our approach to proto_library() depending on a
+ copied filegroup. (Fixed in bazel 0.5.4)
+ """
+ expected = apple_common.dotted_version("0.5.4")
+ current = apple_common.dotted_version(native.bazel_version)
+ if current.compare_to(expected) < 0:
+ fail("Bazel must be newer than 0.5.4")
diff --git a/protoc-artifacts/README.md b/protoc-artifacts/README.md
index fc8ef586..ba3ca018 100644
--- a/protoc-artifacts/README.md
+++ b/protoc-artifacts/README.md
@@ -68,7 +68,7 @@ configure GPG and Sonatype account.
You need to perform the deployment for every platform that you want to
support. DO NOT close the staging repository until you have done the
deployment for all platforms. Currently the following platforms are supported:
-- Linux (x86_32 and x86_64)
+- Linux (x86_32, x86_64 and cross compiled aarch_64)
- Windows (x86_32 and x86_64) with
- Cygwin64 with MinGW compilers (x86_64)
- MSYS with MinGW32 (x86_32)
@@ -99,6 +99,9 @@ $ mvn clean deploy -P release -Dstaging.repository=comgoogle-123
A 32-bit artifact can be deployed from a 64-bit host with
``-Dos.detected.arch=x86_32``
+An arm64 artifact can be deployed from x86 host with
+``-Dos.detected.arch=aarch_64``
+
A windows artifact can be deployed from a linux machine with
``-Dos.detected.name=windows``
diff --git a/python/MANIFEST.in b/python/MANIFEST.in
index 26088826..5fb01922 100644
--- a/python/MANIFEST.in
+++ b/python/MANIFEST.in
@@ -4,6 +4,9 @@ exclude google/protobuf/internal/*_test.py
exclude google/protobuf/internal/*.proto
exclude google/protobuf/internal/test_util.py
+recursive-include google *.cc
+recursive-include google *.h
+
recursive-exclude google *_test.py
recursive-exclude google *_test.proto
recursive-exclude google unittest*_pb2.py
diff --git a/python/google/protobuf/descriptor.py b/python/google/protobuf/descriptor.py
index b1f3ca38..0d35425f 100755
--- a/python/google/protobuf/descriptor.py
+++ b/python/google/protobuf/descriptor.py
@@ -41,8 +41,8 @@ from google.protobuf.internal import api_implementation
_USE_C_DESCRIPTORS = False
if api_implementation.Type() == 'cpp':
# Used by MakeDescriptor in cpp mode
+ import binascii
import os
- import uuid
from google.protobuf.pyext import _message
_USE_C_DESCRIPTORS = getattr(_message, '_USE_C_DESCRIPTORS', False)
@@ -952,7 +952,7 @@ def MakeDescriptor(desc_proto, package='', build_file_if_cpp=True,
# imported ones. We need to specify a file name so the descriptor pool
# accepts our FileDescriptorProto, but it is not important what that file
# name is actually set to.
- proto_name = str(uuid.uuid4())
+ proto_name = binascii.hexlify(os.urandom(16)).decode('ascii')
if package:
file_descriptor_proto.name = os.path.join(package.replace('.', '/'),
diff --git a/python/google/protobuf/descriptor_database.py b/python/google/protobuf/descriptor_database.py
index b8f5140b..8b7715cd 100644
--- a/python/google/protobuf/descriptor_database.py
+++ b/python/google/protobuf/descriptor_database.py
@@ -32,6 +32,8 @@
__author__ = 'matthewtoia@google.com (Matt Toia)'
+import warnings
+
class Error(Exception):
pass
@@ -64,21 +66,20 @@ class DescriptorDatabase(object):
elif self._file_desc_protos_by_file[proto_name] != file_desc_proto:
raise DescriptorDatabaseConflictingDefinitionError(
'%s already added, but with different descriptor.' % proto_name)
+ else:
+ return
# Add all the top-level descriptors to the index.
package = file_desc_proto.package
for message in file_desc_proto.message_type:
- self._file_desc_protos_by_symbol.update(
- (name, file_desc_proto) for name in _ExtractSymbols(message, package))
+ for name in _ExtractSymbols(message, package):
+ self._AddSymbol(name, file_desc_proto)
for enum in file_desc_proto.enum_type:
- self._file_desc_protos_by_symbol[
- '.'.join((package, enum.name))] = file_desc_proto
+ self._AddSymbol(('.'.join((package, enum.name))), file_desc_proto)
for extension in file_desc_proto.extension:
- self._file_desc_protos_by_symbol[
- '.'.join((package, extension.name))] = file_desc_proto
+ self._AddSymbol(('.'.join((package, extension.name))), file_desc_proto)
for service in file_desc_proto.service:
- self._file_desc_protos_by_symbol[
- '.'.join((package, service.name))] = file_desc_proto
+ self._AddSymbol(('.'.join((package, service.name))), file_desc_proto)
def FindFileByName(self, name):
"""Finds the file descriptor proto by file name.
@@ -132,6 +133,15 @@ class DescriptorDatabase(object):
top_level, _, _ = symbol.rpartition('.')
return self._file_desc_protos_by_symbol[top_level]
+ def _AddSymbol(self, name, file_desc_proto):
+ if name in self._file_desc_protos_by_symbol:
+ warn_msg = ('Conflict register for file "' + file_desc_proto.name +
+ '": ' + name +
+ ' is already defined in file "' +
+ self._file_desc_protos_by_symbol[name].name + '"')
+ warnings.warn(warn_msg, RuntimeWarning)
+ self._file_desc_protos_by_symbol[name] = file_desc_proto
+
def _ExtractSymbols(desc_proto, package):
"""Pulls out all the symbols from a descriptor proto.
diff --git a/python/google/protobuf/descriptor_pool.py b/python/google/protobuf/descriptor_pool.py
index f4c533a4..8983f76f 100644
--- a/python/google/protobuf/descriptor_pool.py
+++ b/python/google/protobuf/descriptor_pool.py
@@ -58,6 +58,7 @@ directly instead of this class.
__author__ = 'matthewtoia@google.com (Matt Toia)'
import collections
+import warnings
from google.protobuf import descriptor
from google.protobuf import descriptor_database
@@ -136,6 +137,29 @@ class DescriptorPool(object):
self._extensions_by_name = collections.defaultdict(dict)
self._extensions_by_number = collections.defaultdict(dict)
+ def _CheckConflictRegister(self, desc):
+ """Check if the descriptor name conflicts with another of the same name.
+
+ Args:
+ desc: Descriptor of a message, enum, service or extension.
+ """
+ desc_name = desc.full_name
+ for register, descriptor_type in [
+ (self._descriptors, descriptor.Descriptor),
+ (self._enum_descriptors, descriptor.EnumDescriptor),
+ (self._service_descriptors, descriptor.ServiceDescriptor),
+ (self._toplevel_extensions, descriptor.FieldDescriptor)]:
+ if desc_name in register:
+ file_name = register[desc_name].file.name
+ if not isinstance(desc, descriptor_type) or (
+ file_name != desc.file.name):
+ warn_msg = ('Conflict register for file "' + desc.file.name +
+ '": ' + desc_name +
+ ' is already defined in file "' +
+ file_name + '"')
+ warnings.warn(warn_msg, RuntimeWarning)
+ return
+
def Add(self, file_desc_proto):
"""Adds the FileDescriptorProto and its types to this pool.
@@ -172,6 +196,8 @@ class DescriptorPool(object):
if not isinstance(desc, descriptor.Descriptor):
raise TypeError('Expected instance of descriptor.Descriptor.')
+ self._CheckConflictRegister(desc)
+
self._descriptors[desc.full_name] = desc
self._AddFileDescriptor(desc.file)
@@ -187,6 +213,7 @@ class DescriptorPool(object):
if not isinstance(enum_desc, descriptor.EnumDescriptor):
raise TypeError('Expected instance of descriptor.EnumDescriptor.')
+ self._CheckConflictRegister(enum_desc)
self._enum_descriptors[enum_desc.full_name] = enum_desc
self._AddFileDescriptor(enum_desc.file)
@@ -200,6 +227,7 @@ class DescriptorPool(object):
if not isinstance(service_desc, descriptor.ServiceDescriptor):
raise TypeError('Expected instance of descriptor.ServiceDescriptor.')
+ self._CheckConflictRegister(service_desc)
self._service_descriptors[service_desc.full_name] = service_desc
def AddExtensionDescriptor(self, extension):
@@ -219,6 +247,7 @@ class DescriptorPool(object):
raise TypeError('Expected an extension descriptor.')
if extension.extension_scope is None:
+ self._CheckConflictRegister(extension)
self._toplevel_extensions[extension.full_name] = extension
try:
@@ -689,6 +718,7 @@ class DescriptorPool(object):
fields[field_index].containing_oneof = oneofs[oneof_index]
scope[_PrefixWithDot(desc_name)] = desc
+ self._CheckConflictRegister(desc)
self._descriptors[desc_name] = desc
return desc
@@ -727,6 +757,7 @@ class DescriptorPool(object):
containing_type=containing_type,
options=_OptionsOrNone(enum_proto))
scope['.%s' % enum_name] = desc
+ self._CheckConflictRegister(desc)
self._enum_descriptors[enum_name] = desc
return desc
@@ -923,6 +954,7 @@ class DescriptorPool(object):
methods=methods,
options=_OptionsOrNone(service_proto),
file=file_desc)
+ self._CheckConflictRegister(desc)
self._service_descriptors[service_name] = desc
return desc
diff --git a/python/google/protobuf/internal/containers.py b/python/google/protobuf/internal/containers.py
index 68be9e54..c6a3692a 100755
--- a/python/google/protobuf/internal/containers.py
+++ b/python/google/protobuf/internal/containers.py
@@ -549,10 +549,10 @@ class MessageMap(MutableMapping):
self._values = {}
def __getitem__(self, key):
+ key = self._key_checker.CheckValue(key)
try:
return self._values[key]
except KeyError:
- key = self._key_checker.CheckValue(key)
new_element = self._message_descriptor._concrete_class()
new_element._SetListener(self._message_listener)
self._values[key] = new_element
@@ -584,12 +584,14 @@ class MessageMap(MutableMapping):
return default
def __contains__(self, item):
+ item = self._key_checker.CheckValue(item)
return item in self._values
def __setitem__(self, key, value):
raise ValueError('May not set values directly, call my_map[key].foo = 5')
def __delitem__(self, key):
+ key = self._key_checker.CheckValue(key)
del self._values[key]
self._message_listener.Modified()
diff --git a/python/google/protobuf/internal/descriptor_database_test.py b/python/google/protobuf/internal/descriptor_database_test.py
index 1f1a3db9..f97477b3 100644
--- a/python/google/protobuf/internal/descriptor_database_test.py
+++ b/python/google/protobuf/internal/descriptor_database_test.py
@@ -38,6 +38,7 @@ try:
import unittest2 as unittest #PY26
except ImportError:
import unittest
+import warnings
from google.protobuf import unittest_pb2
from google.protobuf import descriptor_pb2
@@ -98,6 +99,26 @@ class DescriptorDatabaseTest(unittest.TestCase):
db.FindFileContainingSymbol,
'protobuf_unittest.NoneMessage')
+ def testConflictRegister(self):
+ db = descriptor_database.DescriptorDatabase()
+ unittest_fd = descriptor_pb2.FileDescriptorProto.FromString(
+ unittest_pb2.DESCRIPTOR.serialized_pb)
+ db.Add(unittest_fd)
+ conflict_fd = descriptor_pb2.FileDescriptorProto.FromString(
+ unittest_pb2.DESCRIPTOR.serialized_pb)
+ conflict_fd.name = 'other_file'
+ with warnings.catch_warnings(record=True) as w:
+ # Cause all warnings to always be triggered.
+ warnings.simplefilter('always')
+ db.Add(conflict_fd)
+ self.assertTrue(len(w))
+ self.assertIs(w[0].category, RuntimeWarning)
+ self.assertIn('Conflict register for file "other_file": ',
+ str(w[0].message))
+ self.assertIn('already defined in file '
+ '"google/protobuf/unittest.proto"',
+ str(w[0].message))
+
if __name__ == '__main__':
unittest.main()
diff --git a/python/google/protobuf/internal/descriptor_pool_test.py b/python/google/protobuf/internal/descriptor_pool_test.py
index 15c857bb..2cbf7813 100644
--- a/python/google/protobuf/internal/descriptor_pool_test.py
+++ b/python/google/protobuf/internal/descriptor_pool_test.py
@@ -34,8 +34,10 @@
__author__ = 'matthewtoia@google.com (Matt Toia)'
+import copy
import os
import sys
+import warnings
try:
import unittest2 as unittest #PY26
@@ -119,6 +121,14 @@ class DescriptorPoolTestBase(object):
self.assertEqual('google/protobuf/unittest.proto',
file_desc5.name)
+ # Tests the generated pool.
+ assert descriptor_pool.Default().FindFileContainingSymbol(
+ 'google.protobuf.python.internal.Factory2Message.one_more_field')
+ assert descriptor_pool.Default().FindFileContainingSymbol(
+ 'google.protobuf.python.internal.another_field')
+ assert descriptor_pool.Default().FindFileContainingSymbol(
+ 'protobuf_unittest.TestService')
+
def testFindFileContainingSymbolFailure(self):
with self.assertRaises(KeyError):
self.pool.FindFileContainingSymbol('Does not exist')
@@ -492,6 +502,52 @@ class DescriptorPoolTestBase(object):
TEST1_FILE.CheckFile(self, self.pool)
TEST2_FILE.CheckFile(self, self.pool)
+ def testConflictRegister(self):
+ if isinstance(self, SecondaryDescriptorFromDescriptorDB):
+ if api_implementation.Type() == 'cpp':
+ # Cpp extension cannot call Add on a DescriptorPool
+ # that uses a DescriptorDatabase.
+ # TODO(jieluo): Fix python and cpp extension diff.
+ return
+ unittest_fd = descriptor_pb2.FileDescriptorProto.FromString(
+ unittest_pb2.DESCRIPTOR.serialized_pb)
+ conflict_fd = copy.deepcopy(unittest_fd)
+ conflict_fd.name = 'other_file'
+ if api_implementation.Type() == 'cpp':
+ try:
+ self.pool.Add(unittest_fd)
+ self.pool.Add(conflict_fd)
+ except TypeError:
+ pass
+ else:
+ with warnings.catch_warnings(record=True) as w:
+ # Cause all warnings to always be triggered.
+ warnings.simplefilter('always')
+ pool = copy.deepcopy(self.pool)
+ # No warnings to add the same descriptors.
+ file_descriptor = unittest_pb2.DESCRIPTOR
+ pool.AddDescriptor(
+ file_descriptor.message_types_by_name['TestAllTypes'])
+ pool.AddEnumDescriptor(
+ file_descriptor.enum_types_by_name['ForeignEnum'])
+ pool.AddServiceDescriptor(
+ file_descriptor.services_by_name['TestService'])
+ pool.AddExtensionDescriptor(
+ file_descriptor.extensions_by_name['optional_int32_extension'])
+ self.assertEqual(len(w), 0)
+ # Check warnings for conflict descriptors with the same name.
+ pool.Add(unittest_fd)
+ pool.Add(conflict_fd)
+ pool.FindFileByName(unittest_fd.name)
+ pool.FindFileByName(conflict_fd.name)
+ self.assertTrue(len(w))
+ self.assertIs(w[0].category, RuntimeWarning)
+ self.assertIn('Conflict register for file "other_file": ',
+ str(w[0].message))
+ self.assertIn('already defined in file '
+ '"google/protobuf/unittest.proto"',
+ str(w[0].message))
+
class DefaultDescriptorPoolTest(DescriptorPoolTestBase, unittest.TestCase):
diff --git a/python/google/protobuf/internal/descriptor_test.py b/python/google/protobuf/internal/descriptor_test.py
index f1d5934e..02a43d15 100755
--- a/python/google/protobuf/internal/descriptor_test.py
+++ b/python/google/protobuf/internal/descriptor_test.py
@@ -742,6 +742,19 @@ class DescriptorCopyToProtoTest(unittest.TestCase):
deprecated: true
>
>
+ field {
+ name: "deprecated_int32_in_oneof"
+ number: 2
+ label: LABEL_OPTIONAL
+ type: TYPE_INT32
+ options {
+ deprecated: true
+ }
+ oneof_index: 0
+ }
+ oneof_decl {
+ name: "oneof_fields"
+ }
"""
self._InternalTestCopyToProto(
diff --git a/python/google/protobuf/internal/encoder.py b/python/google/protobuf/internal/encoder.py
index 40c62d67..dc7a8ce8 100755
--- a/python/google/protobuf/internal/encoder.py
+++ b/python/google/protobuf/internal/encoder.py
@@ -418,7 +418,8 @@ def _VarintBytes(value):
def TagBytes(field_number, wire_type):
"""Encode the given tag and return the bytes. Only called at startup."""
- return six.binary_type( _VarintBytes(wire_format.PackTag(field_number, wire_type)) )
+ return six.binary_type(
+ _VarintBytes(wire_format.PackTag(field_number, wire_type)))
# --------------------------------------------------------------------
# As with sizers (see above), we have a number of common encoder
diff --git a/python/google/protobuf/internal/message_test.py b/python/google/protobuf/internal/message_test.py
index a303b1aa..8dae6377 100755
--- a/python/google/protobuf/internal/message_test.py
+++ b/python/google/protobuf/internal/message_test.py
@@ -1480,12 +1480,8 @@ class Proto3Test(BaseTestCase):
submsg = msg.map_int32_foreign_message[5]
self.assertIs(submsg, msg.map_int32_foreign_message.get(5))
- # TODO(jieluo): Fix python and cpp extension diff.
- if api_implementation.Type() == 'cpp':
- with self.assertRaises(TypeError):
- msg.map_int32_foreign_message.get('')
- else:
- self.assertEqual(None, msg.map_int32_foreign_message.get(''))
+ with self.assertRaises(TypeError):
+ msg.map_int32_foreign_message.get('')
def testScalarMap(self):
msg = map_unittest_pb2.TestMap()
@@ -1695,12 +1691,8 @@ class Proto3Test(BaseTestCase):
del msg2.map_int32_foreign_message[222]
self.assertFalse(222 in msg2.map_int32_foreign_message)
- if api_implementation.Type() == 'cpp':
- with self.assertRaises(TypeError):
- del msg2.map_int32_foreign_message['']
- else:
- with self.assertRaises(KeyError):
- del msg2.map_int32_foreign_message['']
+ with self.assertRaises(TypeError):
+ del msg2.map_int32_foreign_message['']
def testMergeFromBadType(self):
msg = map_unittest_pb2.TestMap()
diff --git a/python/google/protobuf/internal/text_format_test.py b/python/google/protobuf/internal/text_format_test.py
index a52f133f..ed3445f2 100755
--- a/python/google/protobuf/internal/text_format_test.py
+++ b/python/google/protobuf/internal/text_format_test.py
@@ -828,6 +828,10 @@ class Proto2Tests(TextFormatBase):
' }\n'
' }\n'
' [unknown_extension]: 5\n'
+ ' [unknown_extension_with_number_field] {\n'
+ ' 1: "some_field"\n'
+ ' 2: -0.451\n'
+ ' }\n'
'}\n')
text_format.Parse(text, message, allow_unknown_extension=True)
golden = 'message_set {\n}\n'
@@ -894,7 +898,6 @@ class Proto2Tests(TextFormatBase):
message = unittest_mset_pb2.TestMessageSetContainer()
malformed = ('message_set {\n'
' unknown_field: true\n'
- ' \n' # Missing '>' here.
'}\n')
six.assertRaisesRegex(self,
text_format.ParseError,
@@ -906,7 +909,7 @@ class Proto2Tests(TextFormatBase):
message,
allow_unknown_extension=True)
- # Parse known extension correcty.
+ # Parse known extension correctly.
message = unittest_mset_pb2.TestMessageSetContainer()
text = ('message_set {\n'
' [protobuf_unittest.TestMessageSetExtension1] {\n'
diff --git a/python/google/protobuf/internal/well_known_types_test.py b/python/google/protobuf/internal/well_known_types_test.py
index 291fe4e8..573bc37d 100644
--- a/python/google/protobuf/internal/well_known_types_test.py
+++ b/python/google/protobuf/internal/well_known_types_test.py
@@ -101,7 +101,7 @@ class TimeUtilTest(TimeUtilTestBase):
message.FromJsonString('1970-01-01T00:00:00.1Z')
self.assertEqual(0, message.seconds)
self.assertEqual(100000000, message.nanos)
- # Parsing accpets offsets.
+ # Parsing accepts offsets.
message.FromJsonString('1970-01-01T00:00:00-08:00')
self.assertEqual(8 * 3600, message.seconds)
self.assertEqual(0, message.nanos)
diff --git a/python/google/protobuf/pyext/descriptor_containers.cc b/python/google/protobuf/pyext/descriptor_containers.cc
index d0aae9c9..bc007f7e 100644
--- a/python/google/protobuf/pyext/descriptor_containers.cc
+++ b/python/google/protobuf/pyext/descriptor_containers.cc
@@ -957,55 +957,55 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->field_count();
}
-static ItemDescriptor GetByName(PyContainer* self, const string& name) {
+static const void* GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindFieldByName(name);
}
-static ItemDescriptor GetByCamelcaseName(PyContainer* self,
+static const void* GetByCamelcaseName(PyContainer* self,
const string& name) {
return GetDescriptor(self)->FindFieldByCamelcaseName(name);
}
-static ItemDescriptor GetByNumber(PyContainer* self, int number) {
+static const void* GetByNumber(PyContainer* self, int number) {
return GetDescriptor(self)->FindFieldByNumber(number);
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->field(index);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyFieldDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyFieldDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
}
-static const string& GetItemName(ItemDescriptor item) {
- return item->name();
+static const string& GetItemName(const void* item) {
+ return static_cast<ItemDescriptor>(item)->name();
}
-static const string& GetItemCamelcaseName(ItemDescriptor item) {
- return item->camelcase_name();
+static const string& GetItemCamelcaseName(const void* item) {
+ return static_cast<ItemDescriptor>(item)->camelcase_name();
}
-static int GetItemNumber(ItemDescriptor item) {
- return item->number();
+static int GetItemNumber(const void* item) {
+ return static_cast<ItemDescriptor>(item)->number();
}
-static int GetItemIndex(ItemDescriptor item) {
- return item->index();
+static int GetItemIndex(const void* item) {
+ return static_cast<ItemDescriptor>(item)->index();
}
static DescriptorContainerDef ContainerDef = {
"MessageFields",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)GetByName,
- (GetByCamelcaseNameMethod)GetByCamelcaseName,
- (GetByNumberMethod)GetByNumber,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)GetItemName,
- (GetItemCamelcaseNameMethod)GetItemCamelcaseName,
- (GetItemNumberMethod)GetItemNumber,
- (GetItemIndexMethod)GetItemIndex,
+ Count,
+ GetByIndex,
+ GetByName,
+ GetByCamelcaseName,
+ GetByNumber,
+ NewObjectFromItem,
+ GetItemName,
+ GetItemCamelcaseName,
+ GetItemNumber,
+ GetItemIndex,
};
} // namespace fields
@@ -1035,38 +1035,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->nested_type_count();
}
-static ItemDescriptor GetByName(PyContainer* self, const string& name) {
+static const void* GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindNestedTypeByName(name);
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->nested_type(index);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyMessageDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyMessageDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
}
-static const string& GetItemName(ItemDescriptor item) {
- return item->name();
+static const string& GetItemName(const void* item) {
+ return static_cast<ItemDescriptor>(item)->name();
}
-static int GetItemIndex(ItemDescriptor item) {
- return item->index();
+static int GetItemIndex(const void* item) {
+ return static_cast<ItemDescriptor>(item)->index();
}
static DescriptorContainerDef ContainerDef = {
"MessageNestedTypes",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)GetByName,
- (GetByCamelcaseNameMethod)NULL,
- (GetByNumberMethod)NULL,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)GetItemName,
- (GetItemCamelcaseNameMethod)NULL,
- (GetItemNumberMethod)NULL,
- (GetItemIndexMethod)GetItemIndex,
+ Count,
+ GetByIndex,
+ GetByName,
+ NULL,
+ NULL,
+ NewObjectFromItem,
+ GetItemName,
+ NULL,
+ NULL,
+ GetItemIndex,
};
} // namespace nested_types
@@ -1087,38 +1087,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->enum_type_count();
}
-static ItemDescriptor GetByName(PyContainer* self, const string& name) {
+static const void* GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindEnumTypeByName(name);
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->enum_type(index);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyEnumDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyEnumDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
}
-static const string& GetItemName(ItemDescriptor item) {
- return item->name();
+static const string& GetItemName(const void* item) {
+ return static_cast<ItemDescriptor>(item)->name();
}
-static int GetItemIndex(ItemDescriptor item) {
- return item->index();
+static int GetItemIndex(const void* item) {
+ return static_cast<ItemDescriptor>(item)->index();
}
static DescriptorContainerDef ContainerDef = {
"MessageNestedEnums",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)GetByName,
- (GetByCamelcaseNameMethod)NULL,
- (GetByNumberMethod)NULL,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)GetItemName,
- (GetItemCamelcaseNameMethod)NULL,
- (GetItemNumberMethod)NULL,
- (GetItemIndexMethod)GetItemIndex,
+ Count,
+ GetByIndex,
+ GetByName,
+ NULL,
+ NULL,
+ NewObjectFromItem,
+ GetItemName,
+ NULL,
+ NULL,
+ GetItemIndex,
};
} // namespace enums
@@ -1150,11 +1150,11 @@ static int Count(PyContainer* self) {
return count;
}
-static ItemDescriptor GetByName(PyContainer* self, const string& name) {
+static const void* GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindEnumValueByName(name);
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
// This is not optimal, but the number of enums *types* in a given message
// is small. This function is only used when iterating over the mapping.
const EnumDescriptor* enum_type = NULL;
@@ -1173,26 +1173,27 @@ static ItemDescriptor GetByIndex(PyContainer* self, int index) {
return enum_type->value(index);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyEnumValueDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyEnumValueDescriptor_FromDescriptor(
+ static_cast<ItemDescriptor>(item));
}
-static const string& GetItemName(ItemDescriptor item) {
- return item->name();
+static const string& GetItemName(const void* item) {
+ return static_cast<ItemDescriptor>(item)->name();
}
static DescriptorContainerDef ContainerDef = {
"MessageEnumValues",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)GetByName,
- (GetByCamelcaseNameMethod)NULL,
- (GetByNumberMethod)NULL,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)GetItemName,
- (GetItemCamelcaseNameMethod)NULL,
- (GetItemNumberMethod)NULL,
- (GetItemIndexMethod)NULL,
+ Count,
+ GetByIndex,
+ GetByName,
+ NULL,
+ NULL,
+ NewObjectFromItem,
+ GetItemName,
+ NULL,
+ NULL,
+ NULL,
};
} // namespace enumvalues
@@ -1209,38 +1210,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->extension_count();
}
-static ItemDescriptor GetByName(PyContainer* self, const string& name) {
+static const void* GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindExtensionByName(name);
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->extension(index);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyFieldDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyFieldDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
}
-static const string& GetItemName(ItemDescriptor item) {
- return item->name();
+static const string& GetItemName(const void* item) {
+ return static_cast<ItemDescriptor>(item)->name();
}
-static int GetItemIndex(ItemDescriptor item) {
- return item->index();
+static int GetItemIndex(const void* item) {
+ return static_cast<ItemDescriptor>(item)->index();
}
static DescriptorContainerDef ContainerDef = {
"MessageExtensions",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)GetByName,
- (GetByCamelcaseNameMethod)NULL,
- (GetByNumberMethod)NULL,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)GetItemName,
- (GetItemCamelcaseNameMethod)NULL,
- (GetItemNumberMethod)NULL,
- (GetItemIndexMethod)GetItemIndex,
+ Count,
+ GetByIndex,
+ GetByName,
+ NULL,
+ NULL,
+ NewObjectFromItem,
+ GetItemName,
+ NULL,
+ NULL,
+ GetItemIndex,
};
} // namespace extensions
@@ -1261,38 +1262,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->oneof_decl_count();
}
-static ItemDescriptor GetByName(PyContainer* self, const string& name) {
+static const void* GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindOneofByName(name);
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->oneof_decl(index);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyOneofDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyOneofDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
}
-static const string& GetItemName(ItemDescriptor item) {
- return item->name();
+static const string& GetItemName(const void* item) {
+ return static_cast<ItemDescriptor>(item)->name();
}
-static int GetItemIndex(ItemDescriptor item) {
- return item->index();
+static int GetItemIndex(const void* item) {
+ return static_cast<ItemDescriptor>(item)->index();
}
static DescriptorContainerDef ContainerDef = {
"MessageOneofs",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)GetByName,
- (GetByCamelcaseNameMethod)NULL,
- (GetByNumberMethod)NULL,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)GetItemName,
- (GetItemCamelcaseNameMethod)NULL,
- (GetItemNumberMethod)NULL,
- (GetItemIndexMethod)GetItemIndex,
+ Count,
+ GetByIndex,
+ GetByName,
+ NULL,
+ NULL,
+ NewObjectFromItem,
+ GetItemName,
+ NULL,
+ NULL,
+ GetItemIndex,
};
} // namespace oneofs
@@ -1323,46 +1324,47 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->value_count();
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->value(index);
}
-static ItemDescriptor GetByName(PyContainer* self, const string& name) {
+static const void* GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindValueByName(name);
}
-static ItemDescriptor GetByNumber(PyContainer* self, int number) {
+static const void* GetByNumber(PyContainer* self, int number) {
return GetDescriptor(self)->FindValueByNumber(number);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyEnumValueDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyEnumValueDescriptor_FromDescriptor(
+ static_cast<ItemDescriptor>(item));
}
-static const string& GetItemName(ItemDescriptor item) {
- return item->name();
+static const string& GetItemName(const void* item) {
+ return static_cast<ItemDescriptor>(item)->name();
}
-static int GetItemNumber(ItemDescriptor item) {
- return item->number();
+static int GetItemNumber(const void* item) {
+ return static_cast<ItemDescriptor>(item)->number();
}
-static int GetItemIndex(ItemDescriptor item) {
- return item->index();
+static int GetItemIndex(const void* item) {
+ return static_cast<ItemDescriptor>(item)->index();
}
static DescriptorContainerDef ContainerDef = {
"EnumValues",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)GetByName,
- (GetByCamelcaseNameMethod)NULL,
- (GetByNumberMethod)GetByNumber,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)GetItemName,
- (GetItemCamelcaseNameMethod)NULL,
- (GetItemNumberMethod)GetItemNumber,
- (GetItemIndexMethod)GetItemIndex,
+ Count,
+ GetByIndex,
+ GetByName,
+ NULL,
+ GetByNumber,
+ NewObjectFromItem,
+ GetItemName,
+ NULL,
+ GetItemNumber,
+ GetItemIndex,
};
} // namespace enumvalues
@@ -1397,30 +1399,30 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->field_count();
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->field(index);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyFieldDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyFieldDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
}
-static int GetItemIndex(ItemDescriptor item) {
- return item->index_in_oneof();
+static int GetItemIndex(const void* item) {
+ return static_cast<ItemDescriptor>(item)->index_in_oneof();
}
static DescriptorContainerDef ContainerDef = {
"OneofFields",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)NULL,
- (GetByCamelcaseNameMethod)NULL,
- (GetByNumberMethod)NULL,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)NULL,
- (GetItemCamelcaseNameMethod)NULL,
- (GetItemNumberMethod)NULL,
- (GetItemIndexMethod)GetItemIndex,
+ Count,
+ GetByIndex,
+ NULL,
+ NULL,
+ NULL,
+ NewObjectFromItem,
+ NULL,
+ NULL,
+ NULL,
+ GetItemIndex,
};
} // namespace fields
@@ -1447,38 +1449,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->method_count();
}
-static ItemDescriptor GetByName(PyContainer* self, const string& name) {
+static const void* GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindMethodByName(name);
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->method(index);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyMethodDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyMethodDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
}
-static const string& GetItemName(ItemDescriptor item) {
- return item->name();
+static const string& GetItemName(const void* item) {
+ return static_cast<ItemDescriptor>(item)->name();
}
-static int GetItemIndex(ItemDescriptor item) {
- return item->index();
+static int GetItemIndex(const void* item) {
+ return static_cast<ItemDescriptor>(item)->index();
}
static DescriptorContainerDef ContainerDef = {
"ServiceMethods",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)GetByName,
- (GetByCamelcaseNameMethod)NULL,
- (GetByNumberMethod)NULL,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)GetItemName,
- (GetItemCamelcaseNameMethod)NULL,
- (GetItemNumberMethod)NULL,
- (GetItemIndexMethod)GetItemIndex,
+ Count,
+ GetByIndex,
+ GetByName,
+ NULL,
+ NULL,
+ NewObjectFromItem,
+ GetItemName,
+ NULL,
+ NULL,
+ GetItemIndex,
};
} // namespace methods
@@ -1509,38 +1511,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->message_type_count();
}
-static ItemDescriptor GetByName(PyContainer* self, const string& name) {
+static const void* GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindMessageTypeByName(name);
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->message_type(index);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyMessageDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyMessageDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
}
-static const string& GetItemName(ItemDescriptor item) {
- return item->name();
+static const string& GetItemName(const void* item) {
+ return static_cast<ItemDescriptor>(item)->name();
}
-static int GetItemIndex(ItemDescriptor item) {
- return item->index();
+static int GetItemIndex(const void* item) {
+ return static_cast<ItemDescriptor>(item)->index();
}
static DescriptorContainerDef ContainerDef = {
"FileMessages",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)GetByName,
- (GetByCamelcaseNameMethod)NULL,
- (GetByNumberMethod)NULL,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)GetItemName,
- (GetItemCamelcaseNameMethod)NULL,
- (GetItemNumberMethod)NULL,
- (GetItemIndexMethod)GetItemIndex,
+ Count,
+ GetByIndex,
+ GetByName,
+ NULL,
+ NULL,
+ NewObjectFromItem,
+ GetItemName,
+ NULL,
+ NULL,
+ GetItemIndex,
};
} // namespace messages
@@ -1557,38 +1559,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->enum_type_count();
}
-static ItemDescriptor GetByName(PyContainer* self, const string& name) {
+static const void* GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindEnumTypeByName(name);
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->enum_type(index);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyEnumDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyEnumDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
}
-static const string& GetItemName(ItemDescriptor item) {
- return item->name();
+static const string& GetItemName(const void* item) {
+ return static_cast<ItemDescriptor>(item)->name();
}
-static int GetItemIndex(ItemDescriptor item) {
- return item->index();
+static int GetItemIndex(const void* item) {
+ return static_cast<ItemDescriptor>(item)->index();
}
static DescriptorContainerDef ContainerDef = {
"FileEnums",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)GetByName,
- (GetByCamelcaseNameMethod)NULL,
- (GetByNumberMethod)NULL,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)GetItemName,
- (GetItemCamelcaseNameMethod)NULL,
- (GetItemNumberMethod)NULL,
- (GetItemIndexMethod)GetItemIndex,
+ Count,
+ GetByIndex,
+ GetByName,
+ NULL,
+ NULL,
+ NewObjectFromItem,
+ GetItemName,
+ NULL,
+ NULL,
+ GetItemIndex,
};
} // namespace enums
@@ -1605,38 +1607,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->extension_count();
}
-static ItemDescriptor GetByName(PyContainer* self, const string& name) {
+static const void* GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindExtensionByName(name);
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->extension(index);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyFieldDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyFieldDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
}
-static const string& GetItemName(ItemDescriptor item) {
- return item->name();
+static const string& GetItemName(const void* item) {
+ return static_cast<ItemDescriptor>(item)->name();
}
-static int GetItemIndex(ItemDescriptor item) {
- return item->index();
+static int GetItemIndex(const void* item) {
+ return static_cast<ItemDescriptor>(item)->index();
}
static DescriptorContainerDef ContainerDef = {
"FileExtensions",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)GetByName,
- (GetByCamelcaseNameMethod)NULL,
- (GetByNumberMethod)NULL,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)GetItemName,
- (GetItemCamelcaseNameMethod)NULL,
- (GetItemNumberMethod)NULL,
- (GetItemIndexMethod)GetItemIndex,
+ Count,
+ GetByIndex,
+ GetByName,
+ NULL,
+ NULL,
+ NewObjectFromItem,
+ GetItemName,
+ NULL,
+ NULL,
+ GetItemIndex,
};
} // namespace extensions
@@ -1653,38 +1655,38 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->service_count();
}
-static ItemDescriptor GetByName(PyContainer* self, const string& name) {
+static const void* GetByName(PyContainer* self, const string& name) {
return GetDescriptor(self)->FindServiceByName(name);
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->service(index);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyServiceDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyServiceDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
}
-static const string& GetItemName(ItemDescriptor item) {
- return item->name();
+static const string& GetItemName(const void* item) {
+ return static_cast<ItemDescriptor>(item)->name();
}
-static int GetItemIndex(ItemDescriptor item) {
- return item->index();
+static int GetItemIndex(const void* item) {
+ return static_cast<ItemDescriptor>(item)->index();
}
static DescriptorContainerDef ContainerDef = {
"FileServices",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)GetByName,
- (GetByCamelcaseNameMethod)NULL,
- (GetByNumberMethod)NULL,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)GetItemName,
- (GetItemCamelcaseNameMethod)NULL,
- (GetItemNumberMethod)NULL,
- (GetItemIndexMethod)GetItemIndex,
+ Count,
+ GetByIndex,
+ GetByName,
+ NULL,
+ NULL,
+ NewObjectFromItem,
+ GetItemName,
+ NULL,
+ NULL,
+ GetItemIndex,
};
} // namespace services
@@ -1701,26 +1703,26 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->dependency_count();
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->dependency(index);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyFileDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyFileDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
}
static DescriptorContainerDef ContainerDef = {
"FileDependencies",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)NULL,
- (GetByCamelcaseNameMethod)NULL,
- (GetByNumberMethod)NULL,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)NULL,
- (GetItemCamelcaseNameMethod)NULL,
- (GetItemNumberMethod)NULL,
- (GetItemIndexMethod)NULL,
+ Count,
+ GetByIndex,
+ NULL,
+ NULL,
+ NULL,
+ NewObjectFromItem,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
};
} // namespace dependencies
@@ -1737,26 +1739,26 @@ static int Count(PyContainer* self) {
return GetDescriptor(self)->public_dependency_count();
}
-static ItemDescriptor GetByIndex(PyContainer* self, int index) {
+static const void* GetByIndex(PyContainer* self, int index) {
return GetDescriptor(self)->public_dependency(index);
}
-static PyObject* NewObjectFromItem(ItemDescriptor item) {
- return PyFileDescriptor_FromDescriptor(item);
+static PyObject* NewObjectFromItem(const void* item) {
+ return PyFileDescriptor_FromDescriptor(static_cast<ItemDescriptor>(item));
}
static DescriptorContainerDef ContainerDef = {
"FilePublicDependencies",
- (CountMethod)Count,
- (GetByIndexMethod)GetByIndex,
- (GetByNameMethod)NULL,
- (GetByCamelcaseNameMethod)NULL,
- (GetByNumberMethod)NULL,
- (NewObjectFromItemMethod)NewObjectFromItem,
- (GetItemNameMethod)NULL,
- (GetItemCamelcaseNameMethod)NULL,
- (GetItemNumberMethod)NULL,
- (GetItemIndexMethod)NULL,
+ Count,
+ GetByIndex,
+ NULL,
+ NULL,
+ NULL,
+ NewObjectFromItem,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
};
} // namespace public_dependencies
diff --git a/python/google/protobuf/pyext/message.cc b/python/google/protobuf/pyext/message.cc
index ef75acab..f515b560 100644
--- a/python/google/protobuf/pyext/message.cc
+++ b/python/google/protobuf/pyext/message.cc
@@ -605,18 +605,16 @@ void OutOfRangeError(PyObject* arg) {
template<class RangeType, class ValueType>
bool VerifyIntegerCastAndRange(PyObject* arg, ValueType value) {
- if
- GOOGLE_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.
- PyErr_Clear();
- OutOfRangeError(arg);
- } // Otherwise propagate existing error.
- return false;
+ if (GOOGLE_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.
+ PyErr_Clear();
+ OutOfRangeError(arg);
+ } // Otherwise propagate existing error.
+ return false;
}
- if
- GOOGLE_PREDICT_FALSE(!IsValidNumericCast<RangeType>(value)) {
+ if (GOOGLE_PREDICT_FALSE(!IsValidNumericCast<RangeType>(value))) {
OutOfRangeError(arg);
return false;
}
@@ -628,26 +626,22 @@ bool CheckAndGetInteger(PyObject* arg, T* value) {
// The fast path.
#if PY_MAJOR_VERSION < 3
// For the typical case, offer a fast path.
- if
- GOOGLE_PREDICT_TRUE(PyInt_Check(arg)) {
- long int_result = PyInt_AsLong(arg);
- if
- GOOGLE_PREDICT_TRUE(IsValidNumericCast<T>(int_result)) {
- *value = static_cast<T>(int_result);
- return true;
- }
- else {
- OutOfRangeError(arg);
- return false;
- }
+ if (GOOGLE_PREDICT_TRUE(PyInt_Check(arg))) {
+ long int_result = PyInt_AsLong(arg);
+ if (GOOGLE_PREDICT_TRUE(IsValidNumericCast<T>(int_result))) {
+ *value = static_cast<T>(int_result);
+ return true;
+ } else {
+ OutOfRangeError(arg);
+ return false;
+ }
}
#endif
// This effectively defines an integer as "an object that can be cast as
// an integer and can be used as an ordinal number".
// This definition includes everything that implements numbers.Integral
// and shouldn't cast the net too wide.
- if
- GOOGLE_PREDICT_FALSE(!PyIndex_Check(arg)) {
+ if (GOOGLE_PREDICT_FALSE(!PyIndex_Check(arg))) {
FormatTypeError(arg, "int, long");
return false;
}
@@ -664,10 +658,9 @@ bool CheckAndGetInteger(PyObject* arg, T* value) {
// Unlike PyLong_AsLongLong, PyLong_AsUnsignedLongLong is very
// picky about the exact type.
PyObject* casted = PyNumber_Long(arg);
- if
- GOOGLE_PREDICT_FALSE(casted == NULL) {
- // Propagate existing error.
- return false;
+ if (GOOGLE_PREDICT_FALSE(casted == NULL)) {
+ // Propagate existing error.
+ return false;
}
ulong_result = PyLong_AsUnsignedLongLong(casted);
Py_DECREF(casted);
@@ -690,10 +683,9 @@ bool CheckAndGetInteger(PyObject* arg, T* value) {
// Valid subclasses of numbers.Integral should have a __long__() method
// so fall back to that.
PyObject* casted = PyNumber_Long(arg);
- if
- GOOGLE_PREDICT_FALSE(casted == NULL) {
- // Propagate existing error.
- return false;
+ if (GOOGLE_PREDICT_FALSE(casted == NULL)) {
+ // Propagate existing error.
+ return false;
}
long_result = PyLong_AsLongLong(casted);
Py_DECREF(casted);
@@ -717,10 +709,9 @@ template bool CheckAndGetInteger<uint64>(PyObject*, uint64*);
bool CheckAndGetDouble(PyObject* arg, double* value) {
*value = PyFloat_AsDouble(arg);
- if
- GOOGLE_PREDICT_FALSE(*value == -1 && PyErr_Occurred()) {
- FormatTypeError(arg, "int, long, float");
- return false;
+ if (GOOGLE_PREDICT_FALSE(*value == -1 && PyErr_Occurred())) {
+ FormatTypeError(arg, "int, long, float");
+ return false;
}
return true;
}
@@ -1187,7 +1178,7 @@ int InitAttributes(CMessage* self, PyObject* args, PyObject* kwargs) {
continue;
}
if (descriptor->is_map()) {
- ScopedPyObjectPtr map(GetAttr(self, name));
+ ScopedPyObjectPtr map(GetAttr(reinterpret_cast<PyObject*>(self), name));
const FieldDescriptor* value_descriptor =
descriptor->message_type()->FindFieldByName("value");
if (value_descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
@@ -1215,7 +1206,8 @@ int InitAttributes(CMessage* self, PyObject* args, PyObject* kwargs) {
}
}
} else if (descriptor->label() == FieldDescriptor::LABEL_REPEATED) {
- ScopedPyObjectPtr container(GetAttr(self, name));
+ ScopedPyObjectPtr container(
+ GetAttr(reinterpret_cast<PyObject*>(self), name));
if (container == NULL) {
return -1;
}
@@ -1282,7 +1274,8 @@ int InitAttributes(CMessage* self, PyObject* args, PyObject* kwargs) {
}
}
} else if (descriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
- ScopedPyObjectPtr message(GetAttr(self, name));
+ ScopedPyObjectPtr message(
+ GetAttr(reinterpret_cast<PyObject*>(self), name));
if (message == NULL) {
return -1;
}
@@ -1307,8 +1300,8 @@ int InitAttributes(CMessage* self, PyObject* args, PyObject* kwargs) {
return -1;
}
}
- if (SetAttr(self, name, (new_val.get() == NULL) ? value : new_val.get()) <
- 0) {
+ if (SetAttr(reinterpret_cast<PyObject*>(self), name,
+ (new_val.get() == NULL) ? value : new_val.get()) < 0) {
return -1;
}
}
@@ -2211,7 +2204,8 @@ static PyObject* ListFields(CMessage* self) {
return NULL;
}
- PyObject* field_value = GetAttr(self, py_field_name.get());
+ PyObject* field_value =
+ GetAttr(reinterpret_cast<PyObject*>(self), py_field_name.get());
if (field_value == NULL) {
PyErr_SetObject(PyExc_ValueError, py_field_name.get());
return NULL;
@@ -2707,7 +2701,8 @@ static bool SetCompositeField(
return PyDict_SetItem(self->composite_fields, name, value) == 0;
}
-PyObject* GetAttr(CMessage* self, PyObject* name) {
+PyObject* GetAttr(PyObject* pself, PyObject* name) {
+ CMessage* self = reinterpret_cast<CMessage*>(pself);
PyObject* value = self->composite_fields ?
PyDict_GetItem(self->composite_fields, name) : NULL;
if (value != NULL) {
@@ -2785,7 +2780,8 @@ PyObject* GetAttr(CMessage* self, PyObject* name) {
return InternalGetScalar(self->message, field_descriptor);
}
-int SetAttr(CMessage* self, PyObject* name, PyObject* value) {
+int SetAttr(PyObject* pself, PyObject* name, PyObject* value) {
+ CMessage* self = reinterpret_cast<CMessage*>(pself);
if (self->composite_fields && PyDict_Contains(self->composite_fields, name)) {
PyErr_SetString(PyExc_TypeError, "Can't set composite field");
return -1;
@@ -2837,8 +2833,8 @@ PyTypeObject CMessage_Type = {
PyObject_HashNotImplemented, // tp_hash
0, // tp_call
(reprfunc)cmessage::ToStr, // tp_str
- (getattrofunc)cmessage::GetAttr, // tp_getattro
- (setattrofunc)cmessage::SetAttr, // tp_setattro
+ cmessage::GetAttr, // tp_getattro
+ cmessage::SetAttr, // tp_setattro
0, // tp_as_buffer
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, // tp_flags
"A ProtocolMessage", // tp_doc
diff --git a/python/google/protobuf/pyext/message.h b/python/google/protobuf/pyext/message.h
index ce80497e..576d098c 100644
--- a/python/google/protobuf/pyext/message.h
+++ b/python/google/protobuf/pyext/message.h
@@ -240,15 +240,15 @@ PyObject* MergeFrom(CMessage* self, PyObject* arg);
// has been registered with the same field number on this class.
PyObject* RegisterExtension(PyObject* cls, PyObject* extension_handle);
-// Retrieves an attribute named 'name' from CMessage 'self'. Returns
-// the attribute value on success, or NULL on failure.
+// Retrieves an attribute named 'name' from 'self', which is interpreted as a
+// CMessage. Returns the attribute value on success, or null on failure.
//
// Returns a new reference.
-PyObject* GetAttr(CMessage* self, PyObject* name);
+PyObject* GetAttr(PyObject* self, PyObject* name);
-// Set the value of the attribute named 'name', for CMessage 'self',
-// to the value 'value'. Returns -1 on failure.
-int SetAttr(CMessage* self, PyObject* name, PyObject* value);
+// Set the value of the attribute named 'name', for 'self', which is interpreted
+// as a CMessage, to the value 'value'. Returns -1 on failure.
+int SetAttr(PyObject* self, PyObject* name, PyObject* value);
PyObject* FindInitializationErrors(CMessage* self);
diff --git a/python/google/protobuf/text_format.py b/python/google/protobuf/text_format.py
index 6b12632e..36ddd1b7 100755
--- a/python/google/protobuf/text_format.py
+++ b/python/google/protobuf/text_format.py
@@ -938,7 +938,7 @@ def _SkipField(tokenizer):
tokenizer.ConsumeIdentifier()
tokenizer.Consume(']')
else:
- tokenizer.ConsumeIdentifier()
+ tokenizer.ConsumeIdentifierOrNumber()
_SkipFieldContents(tokenizer)
diff --git a/ruby/README.md b/ruby/README.md
index f28e05a7..78e86015 100644
--- a/ruby/README.md
+++ b/ruby/README.md
@@ -16,10 +16,6 @@ install it as you would any other gem:
$ gem install [--prerelease] google-protobuf
-The `--pre` flag is necessary if we have not yet made a non-alpha/beta release
-of the Ruby extension; it allows `gem` to consider these "pre-release"
-alpha/beta versions.
-
Once the gem is installed, you may or may not need `protoc`. If you write your
message type descriptions directly in the Ruby DSL, you do not need it.
However, if you wish to generate the Ruby DSL from a `.proto` file, you will
diff --git a/ruby/ext/google/protobuf_c/storage.c b/ruby/ext/google/protobuf_c/storage.c
index 24064dfd..1437c0b5 100644
--- a/ruby/ext/google/protobuf_c/storage.c
+++ b/ruby/ext/google/protobuf_c/storage.c
@@ -606,12 +606,20 @@ static void check_repeated_field_type(VALUE val, const upb_fielddef* field) {
rb_raise(rb_eTypeError, "Repeated field array has wrong element type");
}
- if (self->field_type == UPB_TYPE_MESSAGE ||
- self->field_type == UPB_TYPE_ENUM) {
+ if (self->field_type == UPB_TYPE_MESSAGE) {
if (self->field_type_class !=
- get_def_obj(upb_fielddef_subdef(field))) {
+ Descriptor_msgclass(get_def_obj(upb_fielddef_subdef(field)))) {
rb_raise(rb_eTypeError,
- "Repeated field array has wrong message/enum class");
+ "Repeated field array has wrong message class");
+ }
+ }
+
+
+ if (self->field_type == UPB_TYPE_ENUM) {
+ if (self->field_type_class !=
+ EnumDescriptor_enummodule(get_def_obj(upb_fielddef_subdef(field)))) {
+ rb_raise(rb_eTypeError,
+ "Repeated field array has wrong enum class");
}
}
}
diff --git a/ruby/tests/repeated_field_test.rb b/ruby/tests/repeated_field_test.rb
index 25727b7b..b64c3991 100644
--- a/ruby/tests/repeated_field_test.rb
+++ b/ruby/tests/repeated_field_test.rb
@@ -126,6 +126,12 @@ class RepeatedFieldTest < Test::Unit::TestCase
assert_equal false, m.repeated_string.empty?
end
+ def test_reassign
+ m = TestMessage.new
+ m.repeated_msg = Google::Protobuf::RepeatedField.new(:message, TestMessage2, [TestMessage2.new(:foo => 1)])
+ assert_equal m.repeated_msg.first, TestMessage2.new(:foo => 1)
+ end
+
def test_array_accessor
m = TestMessage.new
reference_arr = %w(foo bar baz)
diff --git a/src/Makefile.am b/src/Makefile.am
index cdc2298b..aa945d3e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -118,6 +118,7 @@ nobase_include_HEADERS = \
google/protobuf/generated_message_table_driven.h \
google/protobuf/generated_message_util.h \
google/protobuf/has_bits.h \
+ google/protobuf/implicit_weak_message.h \
google/protobuf/map_entry.h \
google/protobuf/map_entry_lite.h \
google/protobuf/map_field.h \
@@ -222,6 +223,7 @@ libprotobuf_lite_la_SOURCES = \
google/protobuf/generated_message_util.cc \
google/protobuf/generated_message_table_driven_lite.h \
google/protobuf/generated_message_table_driven_lite.cc \
+ google/protobuf/implicit_weak_message.cc \
google/protobuf/message_lite.cc \
google/protobuf/repeated_field.cc \
google/protobuf/wire_format_lite.cc \
@@ -587,11 +589,8 @@ EXTRA_DIST = \
$(js_well_known_types_sources) \
solaris/libstdc++.la \
google/protobuf/unittest_proto3.proto \
- google/protobuf/unittest_import_public_proto3.proto \
- google/protobuf/unittest_import_proto3.proto \
google/protobuf/test_messages_proto3.proto \
google/protobuf/test_messages_proto2.proto \
- google/protobuf/map_unittest_proto3.proto \
google/protobuf/io/gzip_stream.h \
google/protobuf/io/gzip_stream_unittest.sh \
google/protobuf/testdata/golden_message \
diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc
index 29687477..4335e467 100644
--- a/src/google/protobuf/any.pb.cc
+++ b/src/google/protobuf/any.pb.cc
@@ -196,13 +196,6 @@ const Any& Any::default_instance() {
return *internal_default_instance();
}
-Any* Any::New(::google::protobuf::Arena* arena) const {
- Any* n = new Any;
- if (arena != NULL) {
- arena->Own(n);
- }
- return n;
-}
void Any::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Any)
@@ -436,5 +429,12 @@ void Any::InternalSwap(Any* other) {
// @@protoc_insertion_point(namespace_scope)
} // namespace protobuf
} // namespace google
+namespace google {
+namespace protobuf {
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Any* Arena::Create< ::google::protobuf::Any >(Arena* arena) {
+ return Arena::CreateInternal< ::google::protobuf::Any >(arena);
+}
+} // namespace protobuf
+} // namespace google
// @@protoc_insertion_point(global_scope)
diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h
index 32847239..14c21a8f 100644
--- a/src/google/protobuf/any.pb.h
+++ b/src/google/protobuf/any.pb.h
@@ -1,8 +1,8 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/any.proto
-#ifndef PROTOBUF_google_2fprotobuf_2fany_2eproto__INCLUDED
-#define PROTOBUF_google_2fprotobuf_2fany_2eproto__INCLUDED
+#ifndef PROTOBUF_google_2fprotobuf_2fany_2eproto_INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fany_2eproto_INCLUDED
#include <string>
@@ -58,6 +58,11 @@ LIBPROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_;
} // namespace google
namespace google {
namespace protobuf {
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Any* Arena::Create< ::google::protobuf::Any>(Arena*);
+} // namespace protobuf
+} // namespace google
+namespace google {
+namespace protobuf {
// ===================================================================
@@ -115,9 +120,13 @@ class LIBPROTOBUF_EXPORT Any : public ::google::protobuf::Message /* @@protoc_in
// implements Message ----------------------------------------------
- inline Any* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Any* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<Any>(NULL);
+ }
- Any* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Any* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<Any>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Any& from);
@@ -320,4 +329,4 @@ inline void Any::set_allocated_value(::std::string* value) {
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_google_2fprotobuf_2fany_2eproto__INCLUDED
+#endif // PROTOBUF_google_2fprotobuf_2fany_2eproto_INCLUDED
diff --git a/src/google/protobuf/any.proto b/src/google/protobuf/any.proto
index c7486676..49329425 100644
--- a/src/google/protobuf/any.proto
+++ b/src/google/protobuf/any.proto
@@ -120,17 +120,18 @@ option objc_class_prefix = "GPB";
// }
//
message Any {
- // A URL/resource name whose content describes the type of the
- // serialized protocol buffer message.
+ // A URL/resource name that uniquely identifies the type of the serialized
+ // protocol buffer message. The last segment of the URL's path must represent
+ // the fully qualified name of the type (as in
+ // `path/google.protobuf.Duration`). The name should be in a canonical form
+ // (e.g., leading "." is not accepted).
//
- // For URLs which use the scheme `http`, `https`, or no scheme, the
- // following restrictions and interpretations apply:
+ // In practice, teams usually precompile into the binary all types that they
+ // expect it to use in the context of Any. However, for URLs which use the
+ // scheme `http`, `https`, or no scheme, one can optionally set up a type
+ // server that maps type URLs to message definitions as follows:
//
// * If no scheme is provided, `https` is assumed.
- // * The last segment of the URL's path must represent the fully
- // qualified name of the type (as in `path/google.protobuf.Duration`).
- // The name should be in a canonical form (e.g., leading "." is
- // not accepted).
// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
// value in binary format, or produce an error.
// * Applications are allowed to cache lookup results based on the
@@ -139,6 +140,10 @@ message Any {
// on changes to types. (Use versioned type names to manage
// 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.
+ //
// Schemes other than `http`, `https` (or the empty scheme) might be
// used with implementation specific semantics.
//
diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc
index 439a47c6..b0354551 100644
--- a/src/google/protobuf/api.pb.cc
+++ b/src/google/protobuf/api.pb.cc
@@ -311,13 +311,6 @@ const Api& Api::default_instance() {
return *internal_default_instance();
}
-Api* Api::New(::google::protobuf::Arena* arena) const {
- Api* n = new Api;
- if (arena != NULL) {
- arena->Own(n);
- }
- return n;
-}
void Api::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Api)
@@ -368,7 +361,8 @@ bool Api::MergePartialFromCodedStream(
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_methods()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_methods()));
} else {
goto handle_unusual;
}
@@ -379,7 +373,8 @@ bool Api::MergePartialFromCodedStream(
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_options()));
} else {
goto handle_unusual;
}
@@ -418,7 +413,8 @@ bool Api::MergePartialFromCodedStream(
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_mixins()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_mixins()));
} else {
goto handle_unusual;
}
@@ -480,14 +476,18 @@ void Api::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->methods_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 2, this->methods(static_cast<int>(i)), output);
+ 2,
+ this->methods(static_cast<int>(i)),
+ output);
}
// repeated .google.protobuf.Option options = 3;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 3, this->options(static_cast<int>(i)), output);
+ 3,
+ this->options(static_cast<int>(i)),
+ output);
}
// string version = 4;
@@ -503,14 +503,16 @@ void Api::SerializeWithCachedSizes(
// .google.protobuf.SourceContext source_context = 5;
if (this->has_source_context()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 5, *this->source_context_, output);
+ 5, *source_context_, output);
}
// repeated .google.protobuf.Mixin mixins = 6;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->mixins_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 6, this->mixins(static_cast<int>(i)), output);
+ 6,
+ this->mixins(static_cast<int>(i)),
+ output);
}
// .google.protobuf.Syntax syntax = 7;
@@ -575,7 +577,7 @@ void Api::SerializeWithCachedSizes(
if (this->has_source_context()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 5, *this->source_context_, deterministic, target);
+ 5, *source_context_, deterministic, target);
}
// repeated .google.protobuf.Mixin mixins = 6;
@@ -660,7 +662,7 @@ size_t Api::ByteSizeLong() const {
if (this->has_source_context()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->source_context_);
+ *source_context_);
}
// .google.protobuf.Syntax syntax = 7;
@@ -741,9 +743,9 @@ void Api::Swap(Api* other) {
}
void Api::InternalSwap(Api* other) {
using std::swap;
- methods_.InternalSwap(&other->methods_);
- options_.InternalSwap(&other->options_);
- mixins_.InternalSwap(&other->mixins_);
+ CastToBase(&methods_)->InternalSwap(CastToBase(&other->methods_));
+ CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
+ CastToBase(&mixins_)->InternalSwap(CastToBase(&other->mixins_));
name_.Swap(&other->name_);
version_.Swap(&other->version_);
swap(source_context_, other->source_context_);
@@ -843,13 +845,6 @@ const Method& Method::default_instance() {
return *internal_default_instance();
}
-Method* Method::New(::google::protobuf::Arena* arena) const {
- Method* n = new Method;
- if (arena != NULL) {
- arena->Own(n);
- }
- return n;
-}
void Method::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Method)
@@ -957,7 +952,8 @@ bool Method::MergePartialFromCodedStream(
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_options()));
} else {
goto handle_unusual;
}
@@ -1049,7 +1045,9 @@ void Method::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 6, this->options(static_cast<int>(i)), output);
+ 6,
+ this->options(static_cast<int>(i)),
+ output);
}
// .google.protobuf.Syntax syntax = 7;
@@ -1271,7 +1269,7 @@ void Method::Swap(Method* other) {
}
void Method::InternalSwap(Method* other) {
using std::swap;
- options_.InternalSwap(&other->options_);
+ CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
name_.Swap(&other->name_);
request_type_url_.Swap(&other->request_type_url_);
response_type_url_.Swap(&other->response_type_url_);
@@ -1352,13 +1350,6 @@ const Mixin& Mixin::default_instance() {
return *internal_default_instance();
}
-Mixin* Mixin::New(::google::protobuf::Arena* arena) const {
- Mixin* n = new Mixin;
- if (arena != NULL) {
- arena->Own(n);
- }
- return n;
-}
void Mixin::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Mixin)
@@ -1604,5 +1595,18 @@ void Mixin::InternalSwap(Mixin* other) {
// @@protoc_insertion_point(namespace_scope)
} // namespace protobuf
} // namespace google
+namespace google {
+namespace protobuf {
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Api* Arena::Create< ::google::protobuf::Api >(Arena* arena) {
+ return Arena::CreateInternal< ::google::protobuf::Api >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Method* Arena::Create< ::google::protobuf::Method >(Arena* arena) {
+ return Arena::CreateInternal< ::google::protobuf::Method >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Mixin* Arena::Create< ::google::protobuf::Mixin >(Arena* arena) {
+ return Arena::CreateInternal< ::google::protobuf::Mixin >(arena);
+}
+} // namespace protobuf
+} // namespace google
// @@protoc_insertion_point(global_scope)
diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h
index 96ff3f15..648aa308 100644
--- a/src/google/protobuf/api.pb.h
+++ b/src/google/protobuf/api.pb.h
@@ -1,8 +1,8 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/api.proto
-#ifndef PROTOBUF_google_2fprotobuf_2fapi_2eproto__INCLUDED
-#define PROTOBUF_google_2fprotobuf_2fapi_2eproto__INCLUDED
+#ifndef PROTOBUF_google_2fprotobuf_2fapi_2eproto_INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fapi_2eproto_INCLUDED
#include <string>
@@ -71,6 +71,13 @@ LIBPROTOBUF_EXPORT extern MixinDefaultTypeInternal _Mixin_default_instance_;
} // namespace google
namespace google {
namespace protobuf {
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Api* Arena::Create< ::google::protobuf::Api>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Method* Arena::Create< ::google::protobuf::Method>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Mixin* Arena::Create< ::google::protobuf::Mixin>(Arena*);
+} // namespace protobuf
+} // namespace google
+namespace google {
+namespace protobuf {
// ===================================================================
@@ -118,9 +125,13 @@ class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_in
// implements Message ----------------------------------------------
- inline Api* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Api* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<Api>(NULL);
+ }
- Api* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Api* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<Api>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Api& from);
@@ -160,11 +171,11 @@ class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_in
int methods_size() const;
void clear_methods();
static const int kMethodsFieldNumber = 2;
- const ::google::protobuf::Method& methods(int index) const;
::google::protobuf::Method* mutable_methods(int index);
- ::google::protobuf::Method* add_methods();
::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >*
mutable_methods();
+ const ::google::protobuf::Method& methods(int index) const;
+ ::google::protobuf::Method* add_methods();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >&
methods() const;
@@ -172,11 +183,11 @@ class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_in
int options_size() const;
void clear_options();
static const int kOptionsFieldNumber = 3;
- const ::google::protobuf::Option& options(int index) const;
::google::protobuf::Option* mutable_options(int index);
- ::google::protobuf::Option* add_options();
::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
mutable_options();
+ const ::google::protobuf::Option& options(int index) const;
+ ::google::protobuf::Option* add_options();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
options() const;
@@ -184,11 +195,11 @@ class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_in
int mixins_size() const;
void clear_mixins();
static const int kMixinsFieldNumber = 6;
- const ::google::protobuf::Mixin& mixins(int index) const;
::google::protobuf::Mixin* mutable_mixins(int index);
- ::google::protobuf::Mixin* add_mixins();
::google::protobuf::RepeatedPtrField< ::google::protobuf::Mixin >*
mutable_mixins();
+ const ::google::protobuf::Mixin& mixins(int index) const;
+ ::google::protobuf::Mixin* add_mixins();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Mixin >&
mixins() const;
@@ -296,9 +307,13 @@ class LIBPROTOBUF_EXPORT Method : public ::google::protobuf::Message /* @@protoc
// implements Message ----------------------------------------------
- inline Method* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Method* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<Method>(NULL);
+ }
- Method* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Method* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<Method>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Method& from);
@@ -338,11 +353,11 @@ class LIBPROTOBUF_EXPORT Method : public ::google::protobuf::Message /* @@protoc
int options_size() const;
void clear_options();
static const int kOptionsFieldNumber = 6;
- const ::google::protobuf::Option& options(int index) const;
::google::protobuf::Option* mutable_options(int index);
- ::google::protobuf::Option* add_options();
::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
mutable_options();
+ const ::google::protobuf::Option& options(int index) const;
+ ::google::protobuf::Option* add_options();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
options() const;
@@ -467,9 +482,13 @@ class LIBPROTOBUF_EXPORT Mixin : public ::google::protobuf::Message /* @@protoc_
// implements Message ----------------------------------------------
- inline Mixin* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Mixin* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<Mixin>(NULL);
+ }
- Mixin* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Mixin* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<Mixin>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Mixin& from);
@@ -614,23 +633,23 @@ inline int Api::methods_size() const {
inline void Api::clear_methods() {
methods_.Clear();
}
-inline const ::google::protobuf::Method& Api::methods(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.Api.methods)
- return methods_.Get(index);
-}
inline ::google::protobuf::Method* Api::mutable_methods(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.Api.methods)
return methods_.Mutable(index);
}
-inline ::google::protobuf::Method* Api::add_methods() {
- // @@protoc_insertion_point(field_add:google.protobuf.Api.methods)
- return methods_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >*
Api::mutable_methods() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods)
return &methods_;
}
+inline const ::google::protobuf::Method& Api::methods(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.methods)
+ return methods_.Get(index);
+}
+inline ::google::protobuf::Method* Api::add_methods() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Api.methods)
+ return methods_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >&
Api::methods() const {
// @@protoc_insertion_point(field_list:google.protobuf.Api.methods)
@@ -641,23 +660,23 @@ Api::methods() const {
inline int Api::options_size() const {
return options_.size();
}
-inline const ::google::protobuf::Option& Api::options(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.Api.options)
- return options_.Get(index);
-}
inline ::google::protobuf::Option* Api::mutable_options(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.Api.options)
return options_.Mutable(index);
}
-inline ::google::protobuf::Option* Api::add_options() {
- // @@protoc_insertion_point(field_add:google.protobuf.Api.options)
- return options_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
Api::mutable_options() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options)
return &options_;
}
+inline const ::google::protobuf::Option& Api::options(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.options)
+ return options_.Get(index);
+}
+inline ::google::protobuf::Option* Api::add_options() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Api.options)
+ return options_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
Api::options() const {
// @@protoc_insertion_point(field_list:google.protobuf.Api.options)
@@ -737,7 +756,8 @@ inline ::google::protobuf::SourceContext* Api::release_source_context() {
inline ::google::protobuf::SourceContext* Api::mutable_source_context() {
if (source_context_ == NULL) {
- source_context_ = new ::google::protobuf::SourceContext;
+ source_context_ = ::google::protobuf::Arena::Create< ::google::protobuf::SourceContext >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context)
return source_context_;
@@ -768,23 +788,23 @@ inline int Api::mixins_size() const {
inline void Api::clear_mixins() {
mixins_.Clear();
}
-inline const ::google::protobuf::Mixin& Api::mixins(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.Api.mixins)
- return mixins_.Get(index);
-}
inline ::google::protobuf::Mixin* Api::mutable_mixins(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.Api.mixins)
return mixins_.Mutable(index);
}
-inline ::google::protobuf::Mixin* Api::add_mixins() {
- // @@protoc_insertion_point(field_add:google.protobuf.Api.mixins)
- return mixins_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Mixin >*
Api::mutable_mixins() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.mixins)
return &mixins_;
}
+inline const ::google::protobuf::Mixin& Api::mixins(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.mixins)
+ return mixins_.Get(index);
+}
+inline ::google::protobuf::Mixin* Api::add_mixins() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Api.mixins)
+ return mixins_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Mixin >&
Api::mixins() const {
// @@protoc_insertion_point(field_list:google.protobuf.Api.mixins)
@@ -1000,23 +1020,23 @@ inline void Method::set_response_streaming(bool value) {
inline int Method::options_size() const {
return options_.size();
}
-inline const ::google::protobuf::Option& Method::options(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.Method.options)
- return options_.Get(index);
-}
inline ::google::protobuf::Option* Method::mutable_options(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.Method.options)
return options_.Mutable(index);
}
-inline ::google::protobuf::Option* Method::add_options() {
- // @@protoc_insertion_point(field_add:google.protobuf.Method.options)
- return options_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
Method::mutable_options() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options)
return &options_;
}
+inline const ::google::protobuf::Option& Method::options(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.options)
+ return options_.Get(index);
+}
+inline ::google::protobuf::Option* Method::add_options() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Method.options)
+ return options_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
Method::options() const {
// @@protoc_insertion_point(field_list:google.protobuf.Method.options)
@@ -1162,4 +1182,4 @@ inline void Mixin::set_allocated_root(::std::string* root) {
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_google_2fprotobuf_2fapi_2eproto__INCLUDED
+#endif // PROTOBUF_google_2fprotobuf_2fapi_2eproto_INCLUDED
diff --git a/src/google/protobuf/arena.cc b/src/google/protobuf/arena.cc
index e9289988..e53d7219 100755
--- a/src/google/protobuf/arena.cc
+++ b/src/google/protobuf/arena.cc
@@ -73,14 +73,15 @@ void ArenaImpl::Init() {
// Thread which calls Init() owns the first block. This allows the
// single-threaded case to allocate on the first block without having to
// perform atomic operations.
- InitBlock(initial_block_, &thread_cache(), options_.initial_block_size);
- ThreadInfo* info = NewThreadInfo(initial_block_);
- info->next = NULL;
+ new (initial_block_) Block(options_.initial_block_size, NULL);
+ SerialArena* serial =
+ SerialArena::New(initial_block_, &thread_cache(), this);
+ serial->set_next(NULL);
google::protobuf::internal::NoBarrier_Store(&threads_,
- reinterpret_cast<google::protobuf::internal::AtomicWord>(info));
+ reinterpret_cast<google::protobuf::internal::AtomicWord>(serial));
google::protobuf::internal::NoBarrier_Store(&space_allocated_,
options_.initial_block_size);
- CacheBlock(initial_block_);
+ CacheSerialArena(serial);
} else {
google::protobuf::internal::NoBarrier_Store(&space_allocated_, 0);
}
@@ -103,145 +104,134 @@ uint64 ArenaImpl::Reset() {
return space_allocated;
}
-ArenaImpl::Block* ArenaImpl::NewBlock(void* me, Block* my_last_block,
- size_t min_bytes) {
+ArenaImpl::Block* ArenaImpl::NewBlock(Block* last_block, size_t min_bytes) {
size_t size;
- if (my_last_block != NULL) {
+ if (last_block) {
// Double the current block size, up to a limit.
- size = std::min(2 * my_last_block->size, options_.max_block_size);
+ size = std::min(2 * last_block->size(), options_.max_block_size);
} else {
size = options_.start_block_size;
}
- // Verify that min_bytes + kHeaderSize won't overflow.
- GOOGLE_CHECK_LE(min_bytes, std::numeric_limits<size_t>::max() - kHeaderSize);
- size = std::max(size, kHeaderSize + min_bytes);
+ // Verify that min_bytes + kBlockHeaderSize won't overflow.
+ GOOGLE_CHECK_LE(min_bytes, std::numeric_limits<size_t>::max() - kBlockHeaderSize);
+ size = std::max(size, kBlockHeaderSize + min_bytes);
- Block* b = reinterpret_cast<Block*>(options_.block_alloc(size));
- InitBlock(b, me, size);
+ void* mem = options_.block_alloc(size);
+ Block* b = new (mem) Block(size, last_block);
google::protobuf::internal::NoBarrier_AtomicIncrement(&space_allocated_, size);
return b;
}
-void ArenaImpl::InitBlock(Block* b, void *me, size_t size) {
- b->pos = kHeaderSize;
- b->size = size;
- b->owner = me;
- b->next = NULL;
-#ifdef ADDRESS_SANITIZER
- // Poison the rest of the block for ASAN. It was unpoisoned by the underlying
- // malloc but it's not yet usable until we return it as part of an allocation.
- ASAN_POISON_MEMORY_REGION(
- reinterpret_cast<char*>(b) + b->pos, b->size - b->pos);
-#endif // ADDRESS_SANITIZER
-}
+ArenaImpl::Block::Block(size_t size, Block* next)
+ : next_(next), pos_(kBlockHeaderSize), size_(size) {}
-ArenaImpl::CleanupChunk* ArenaImpl::ExpandCleanupList(CleanupChunk* cleanup,
- Block* b) {
- size_t size = cleanup ? cleanup->size * 2 : kMinCleanupListElements;
+GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
+void ArenaImpl::SerialArena::AddCleanupFallback(void* elem,
+ void (*cleanup)(void*)) {
+ size_t size = cleanup_ ? cleanup_->size * 2 : kMinCleanupListElements;
size = std::min(size, kMaxCleanupListElements);
size_t bytes = internal::AlignUpTo8(CleanupChunk::SizeOf(size));
- if (b->avail() < bytes) {
- b = GetBlock(bytes);
- }
- CleanupChunk* list =
- reinterpret_cast<CleanupChunk*>(AllocFromBlock(b, bytes));
- list->next = b->thread_info->cleanup;
+ CleanupChunk* list = reinterpret_cast<CleanupChunk*>(AllocateAligned(bytes));
+ list->next = cleanup_;
list->size = size;
- list->len = 0;
- b->thread_info->cleanup = list;
- return list;
+
+ cleanup_ = list;
+ cleanup_ptr_ = &list->nodes[0];
+ cleanup_limit_ = &list->nodes[size];
+
+ AddCleanup(elem, cleanup);
}
-inline GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
-void ArenaImpl::AddCleanupInBlock(
- Block* b, void* elem, void (*func)(void*)) {
- CleanupChunk* cleanup = b->thread_info->cleanup;
- if (cleanup == NULL || cleanup->len == cleanup->size) {
- cleanup = ExpandCleanupList(cleanup, b);
+void* ArenaImpl::AllocateAligned(size_t n) {
+ SerialArena* arena;
+ if (GOOGLE_PREDICT_TRUE(GetSerialArenaFast(&arena))) {
+ return arena->AllocateAligned(n);
+ } else {
+ return AllocateAlignedFallback(n);
}
+}
- CleanupNode* node = &cleanup->nodes[cleanup->len++];
-
- node->elem = elem;
- node->cleanup = func;
+void* ArenaImpl::AllocateAlignedAndAddCleanup(size_t n,
+ void (*cleanup)(void*)) {
+ SerialArena* arena;
+ if (GOOGLE_PREDICT_TRUE(GetSerialArenaFast(&arena))) {
+ return arena->AllocateAlignedAndAddCleanup(n, cleanup);
+ } else {
+ return AllocateAlignedAndAddCleanupFallback(n, cleanup);
+ }
}
void ArenaImpl::AddCleanup(void* elem, void (*cleanup)(void*)) {
- return AddCleanupInBlock(GetBlock(0), elem, cleanup);
+ SerialArena* arena;
+ if (GOOGLE_PREDICT_TRUE(GetSerialArenaFast(&arena))) {
+ arena->AddCleanup(elem, cleanup);
+ } else {
+ return AddCleanupFallback(elem, cleanup);
+ }
}
-void* ArenaImpl::AllocateAligned(size_t n) {
- GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned.
-
- return AllocFromBlock(GetBlock(n), n);
+GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
+void* ArenaImpl::AllocateAlignedFallback(size_t n) {
+ return GetSerialArena()->AllocateAligned(n);
}
-void* ArenaImpl::AllocateAlignedAndAddCleanup(size_t n,
- void (*cleanup)(void*)) {
- GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned.
+GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
+void* ArenaImpl::AllocateAlignedAndAddCleanupFallback(size_t n,
+ void (*cleanup)(void*)) {
+ return GetSerialArena()->AllocateAlignedAndAddCleanup(n, cleanup);
+}
- Block* b = GetBlock(n);
- void* mem = AllocFromBlock(b, n);
- AddCleanupInBlock(b, mem, cleanup);
- return mem;
+GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
+void ArenaImpl::AddCleanupFallback(void* elem, void (*cleanup)(void*)) {
+ GetSerialArena()->AddCleanup(elem, cleanup);
}
inline GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
-ArenaImpl::Block* ArenaImpl::GetBlock(size_t n) {
- Block* my_block = NULL;
-
+bool ArenaImpl::GetSerialArenaFast(ArenaImpl::SerialArena** arena) {
// If this thread already owns a block in this arena then try to use that.
// This fast path optimizes the case where multiple threads allocate from the
// same arena.
ThreadCache* tc = &thread_cache();
- if (tc->last_lifecycle_id_seen == lifecycle_id_) {
- my_block = tc->last_block_used_;
- if (my_block->avail() >= n) {
- return my_block;
- }
+ if (GOOGLE_PREDICT_TRUE(tc->last_lifecycle_id_seen == lifecycle_id_)) {
+ *arena = tc->last_serial_arena;
+ return true;
}
- // Check whether we own the last accessed block on this arena.
- // This fast path optimizes the case where a single thread uses multiple
- // arenas.
- Block* b = reinterpret_cast<Block*>(google::protobuf::internal::Acquire_Load(&hint_));
- if (b != NULL && b->owner == tc) {
- my_block = b;
- if (my_block->avail() >= n) {
- return my_block;
- }
+ // Check whether we own the last accessed SerialArena on this arena. This
+ // fast path optimizes the case where a single thread uses multiple arenas.
+ SerialArena* serial =
+ reinterpret_cast<SerialArena*>(google::protobuf::internal::Acquire_Load(&hint_));
+ if (GOOGLE_PREDICT_TRUE(serial != NULL && serial->owner() == tc)) {
+ *arena = serial;
+ return true;
}
- return GetBlockSlow(tc, my_block, n);
+
+ return false;
}
-inline GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
-void* ArenaImpl::AllocFromBlock(Block* b, size_t n) {
- GOOGLE_DCHECK_EQ(internal::AlignUpTo8(b->pos), b->pos); // Must be already aligned.
- GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned.
- GOOGLE_DCHECK_GE(b->avail(), n);
- size_t p = b->pos;
- b->pos = p + n;
+ArenaImpl::SerialArena* ArenaImpl::GetSerialArena() {
+ SerialArena* arena;
+ if (GOOGLE_PREDICT_TRUE(GetSerialArenaFast(&arena))) {
+ return arena;
+ } else {
+ return GetSerialArenaFallback(&thread_cache());
+ }
+}
+
+GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
+void* ArenaImpl::SerialArena::AllocateAlignedFallback(size_t n) {
+ // Sync back to current's pos.
+ head_->set_pos(head_->size() - (limit_ - ptr_));
+
+ head_ = arena_->NewBlock(head_, n);
+ ptr_ = head_->Pointer(head_->pos());
+ limit_ = head_->Pointer(head_->size());
+
#ifdef ADDRESS_SANITIZER
- ASAN_UNPOISON_MEMORY_REGION(reinterpret_cast<char*>(b) + p, n);
+ ASAN_POISON_MEMORY_REGION(ptr_, limit_ - ptr_);
#endif // ADDRESS_SANITIZER
- return reinterpret_cast<char*>(b) + p;
-}
-ArenaImpl::Block* ArenaImpl::GetBlockSlow(void* me, Block* my_full_block,
- size_t n) {
- ThreadInfo* info =
- my_full_block ? my_full_block->thread_info : GetThreadInfo(me, n);
- GOOGLE_DCHECK(info != NULL);
- Block* b = info->head;
- if (b->avail() < n) {
- Block* new_b = NewBlock(me, b, n);
- new_b->thread_info = info;
- new_b->next = b;
- info->head = new_b;
- b = new_b;
- }
- CacheBlock(b);
- return b;
+ return AllocateAligned(n);
}
uint64 ArenaImpl::SpaceAllocated() const {
@@ -249,18 +239,24 @@ uint64 ArenaImpl::SpaceAllocated() const {
}
uint64 ArenaImpl::SpaceUsed() const {
- ThreadInfo* info =
- reinterpret_cast<ThreadInfo*>(google::protobuf::internal::Acquire_Load(&threads_));
+ SerialArena* serial =
+ reinterpret_cast<SerialArena*>(google::protobuf::internal::Acquire_Load(&threads_));
uint64 space_used = 0;
-
- for ( ; info; info = info->next) {
- // Remove the overhead of the ThreadInfo itself.
- space_used -= sizeof(ThreadInfo);
- for (Block* b = info->head; b; b = b->next) {
- space_used += (b->pos - kHeaderSize);
- }
+ for ( ; serial; serial = serial->next()) {
+ space_used += serial->SpaceUsed();
}
+ return space_used;
+}
+uint64 ArenaImpl::SerialArena::SpaceUsed() const {
+ // Get current block's size from ptr_ (since we can't trust head_->pos().
+ uint64 space_used = ptr_ - head_->Pointer(kBlockHeaderSize);
+ // Get subsequent block size from b->pos().
+ for (Block* b = head_->next(); b; b = b->next()) {
+ space_used += (b->pos() - kBlockHeaderSize);
+ }
+ // Remove the overhead of the SerialArena itself.
+ space_used -= kSerialArenaSize;
return space_used;
}
@@ -268,30 +264,45 @@ uint64 ArenaImpl::FreeBlocks() {
uint64 space_allocated = 0;
// By omitting an Acquire barrier we ensure that any user code that doesn't
// properly synchronize Reset() or the destructor will throw a TSAN warning.
- ThreadInfo* info =
- reinterpret_cast<ThreadInfo*>(google::protobuf::internal::NoBarrier_Load(&threads_));
+ SerialArena* serial =
+ reinterpret_cast<SerialArena*>(google::protobuf::internal::NoBarrier_Load(&threads_));
+
+ while (serial) {
+ // This is inside a block we are freeing, so we need to read it now.
+ SerialArena* next = serial->next();
+ space_allocated += ArenaImpl::SerialArena::Free(serial, initial_block_,
+ options_.block_dealloc);
+ // serial is dead now.
+ serial = next;
+ }
- while (info) {
+ return space_allocated;
+}
+
+uint64 ArenaImpl::SerialArena::Free(ArenaImpl::SerialArena* serial,
+ Block* initial_block,
+ void (*block_dealloc)(void*, size_t)) {
+ uint64 space_allocated = 0;
+
+ // We have to be careful in this function, since we will be freeing the Block
+ // that contains this SerialArena. Be careful about accessing |serial|.
+
+ for (Block* b = serial->head_; b; ) {
// This is inside the block we are freeing, so we need to read it now.
- ThreadInfo* next_info = info->next;
- for (Block* b = info->head; b; ) {
- // This is inside the block we are freeing, so we need to read it now.
- Block* next_block = b->next;
- space_allocated += (b->size);
+ Block* next_block = b->next();
+ space_allocated += (b->size());
#ifdef ADDRESS_SANITIZER
- // This memory was provided by the underlying allocator as unpoisoned, so
- // return it in an unpoisoned state.
- ASAN_UNPOISON_MEMORY_REGION(reinterpret_cast<char*>(b), b->size);
+ // This memory was provided by the underlying allocator as unpoisoned, so
+ // return it in an unpoisoned state.
+ ASAN_UNPOISON_MEMORY_REGION(b->Pointer(0), b->size());
#endif // ADDRESS_SANITIZER
- if (b != initial_block_) {
- options_.block_dealloc(b, b->size);
- }
-
- b = next_block;
+ if (b != initial_block) {
+ block_dealloc(b, b->size());
}
- info = next_info;
+
+ b = next_block;
}
return space_allocated;
@@ -300,63 +311,87 @@ uint64 ArenaImpl::FreeBlocks() {
void ArenaImpl::CleanupList() {
// By omitting an Acquire barrier we ensure that any user code that doesn't
// properly synchronize Reset() or the destructor will throw a TSAN warning.
- ThreadInfo* info =
- reinterpret_cast<ThreadInfo*>(google::protobuf::internal::NoBarrier_Load(&threads_));
-
- for ( ; info; info = info->next) {
- CleanupChunk* list = info->cleanup;
- while (list) {
- size_t n = list->len;
- CleanupNode* node = &list->nodes[list->len - 1];
- for (size_t i = 0; i < n; i++, node--) {
- node->cleanup(node->elem);
- }
- list = list->next;
- }
+ SerialArena* serial =
+ reinterpret_cast<SerialArena*>(google::protobuf::internal::NoBarrier_Load(&threads_));
+
+ for ( ; serial; serial = serial->next()) {
+ serial->CleanupList();
}
}
-ArenaImpl::ThreadInfo* ArenaImpl::NewThreadInfo(Block* b) {
- GOOGLE_DCHECK(FindThreadInfo(b->owner) == NULL);
- ThreadInfo* info =
- reinterpret_cast<ThreadInfo*>(AllocFromBlock(b, sizeof(ThreadInfo)));
- b->thread_info = info;
- info->owner = b->owner;
- info->head = b;
- info->cleanup = NULL;
- return info;
+void ArenaImpl::SerialArena::CleanupList() {
+ if (cleanup_ != NULL) {
+ CleanupListFallback();
+ }
}
-ArenaImpl::ThreadInfo* ArenaImpl::FindThreadInfo(void* me) {
- ThreadInfo* info =
- reinterpret_cast<ThreadInfo*>(google::protobuf::internal::Acquire_Load(&threads_));
- for ( ; info; info = info->next) {
- if (info->owner == me) {
- return info;
+void ArenaImpl::SerialArena::CleanupListFallback() {
+ // Cleanup newest chunk: ptrs give us length.
+ size_t n = cleanup_ptr_ - &cleanup_->nodes[0];
+ CleanupNode* node = cleanup_ptr_;
+ for (size_t i = 0; i < n; i++) {
+ --node;
+ node->cleanup(node->elem);
+ }
+
+ // Cleanup older chunks, which are known to be full.
+ CleanupChunk* list = cleanup_->next;
+ while (list) {
+ size_t n = list->size;
+ CleanupNode* node = &list->nodes[list->size];
+ for (size_t i = 0; i < n; i++) {
+ --node;
+ node->cleanup(node->elem);
}
+ list = list->next;
}
+}
- return NULL;
+ArenaImpl::SerialArena* ArenaImpl::SerialArena::New(Block* b, void* owner,
+ ArenaImpl* arena) {
+ GOOGLE_DCHECK_EQ(b->pos(), kBlockHeaderSize); // Should be a fresh block
+ GOOGLE_DCHECK_LE(kBlockHeaderSize + kSerialArenaSize, b->size());
+ SerialArena* serial =
+ reinterpret_cast<SerialArena*>(b->Pointer(kBlockHeaderSize));
+ b->set_pos(kBlockHeaderSize + kSerialArenaSize);
+ serial->arena_ = arena;
+ serial->owner_ = owner;
+ serial->head_ = b;
+ serial->ptr_ = b->Pointer(b->pos());
+ serial->limit_ = b->Pointer(b->size());
+ serial->cleanup_ = NULL;
+ serial->cleanup_ptr_ = NULL;
+ serial->cleanup_limit_ = NULL;
+ return serial;
}
-ArenaImpl::ThreadInfo* ArenaImpl::GetThreadInfo(void* me, size_t n) {
- ThreadInfo* info = FindThreadInfo(me);
+GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
+ArenaImpl::SerialArena* ArenaImpl::GetSerialArenaFallback(void* me) {
+ // Look for this SerialArena in our linked list.
+ SerialArena* serial =
+ reinterpret_cast<SerialArena*>(google::protobuf::internal::Acquire_Load(&threads_));
+ for ( ; serial; serial = serial->next()) {
+ if (serial->owner() == me) {
+ break;
+ }
+ }
- if (!info) {
- // This thread doesn't have any ThreadInfo, which also means it doesn't have
- // any blocks yet. So we'll allocate its first block now.
- Block* b = NewBlock(me, NULL, sizeof(ThreadInfo) + n);
- info = NewThreadInfo(b);
+ if (!serial) {
+ // This thread doesn't have any SerialArena, which also means it doesn't
+ // have any blocks yet. So we'll allocate its first block now.
+ Block* b = NewBlock(NULL, kSerialArenaSize);
+ serial = SerialArena::New(b, me, this);
google::protobuf::internal::AtomicWord head;
do {
head = google::protobuf::internal::NoBarrier_Load(&threads_);
- info->next = reinterpret_cast<ThreadInfo*>(head);
+ serial->set_next(reinterpret_cast<SerialArena*>(head));
} while (google::protobuf::internal::Release_CompareAndSwap(
- &threads_, head, reinterpret_cast<google::protobuf::internal::AtomicWord>(info)) != head);
+ &threads_, head, reinterpret_cast<google::protobuf::internal::AtomicWord>(serial)) != head);
}
- return info;
+ CacheSerialArena(serial);
+ return serial;
}
} // namespace internal
diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h
index 32be9a17..f3cdedac 100644
--- a/src/google/protobuf/arena.h
+++ b/src/google/protobuf/arena.h
@@ -56,6 +56,21 @@ using type_info = ::type_info;
namespace google {
namespace protobuf {
+struct ArenaOptions;
+} // namespace protobuf
+
+namespace quality_webanswers {
+
+void TempPrivateWorkAround(::google::protobuf::ArenaOptions* arena_options);
+
+} // namespace quality_webanswers
+
+namespace protobuf {
+namespace arena_metrics {
+
+void EnableArenaMetrics(::google::protobuf::ArenaOptions* options);
+
+} // namespace arena_metrics
class Arena; // defined below
class Message; // message.h
@@ -117,6 +132,20 @@ struct ArenaOptions {
// from the arena. By default, it contains a ptr to a wrapper function that
// calls free.
void (*block_dealloc)(void*, size_t);
+
+ ArenaOptions()
+ : start_block_size(kDefaultStartBlockSize),
+ max_block_size(kDefaultMaxBlockSize),
+ initial_block(NULL),
+ initial_block_size(0),
+ block_alloc(&::operator new),
+ block_dealloc(&internal::arena_free),
+ on_arena_init(NULL),
+ on_arena_reset(NULL),
+ on_arena_destruction(NULL),
+ on_arena_allocation(NULL) {}
+
+ private:
// Hooks for adding external functionality such as user-specific metrics
// collection, specific debugging abilities, etc.
// Init hook may return a pointer to a cookie to be stored in the arena.
@@ -138,23 +167,15 @@ struct ArenaOptions {
void (*on_arena_allocation)(const std::type_info* allocated_type,
uint64 alloc_size, void* cookie);
- ArenaOptions()
- : start_block_size(kDefaultStartBlockSize),
- max_block_size(kDefaultMaxBlockSize),
- initial_block(NULL),
- initial_block_size(0),
- block_alloc(&::operator new),
- block_dealloc(&internal::arena_free),
- on_arena_init(NULL),
- on_arena_reset(NULL),
- on_arena_destruction(NULL),
- on_arena_allocation(NULL) {}
-
- private:
// Constants define default starting block size and max block size for
// arena allocator behavior -- see descriptions above.
static const size_t kDefaultStartBlockSize = 256;
static const size_t kDefaultMaxBlockSize = 8192;
+
+ friend void ::google::protobuf::arena_metrics::EnableArenaMetrics(ArenaOptions*);
+ friend void quality_webanswers::TempPrivateWorkAround(ArenaOptions*);
+ friend class Arena;
+ friend class ArenaOptionsTestFriend;
};
// Support for non-RTTI environments. (The metrics hooks API uses type
@@ -229,14 +250,15 @@ class LIBPROTOBUF_EXPORT Arena {
// WARNING: if you allocate multiple objects, it is difficult to guarantee
// that a series of allocations will fit in the initial block, especially if
// Arena changes its alignment guarantees in the future!
- static const size_t kBlockOverhead = internal::ArenaImpl::kHeaderSize;
+ static const size_t kBlockOverhead = internal::ArenaImpl::kBlockHeaderSize +
+ internal::ArenaImpl::kSerialArenaSize;
// Default constructor with sensible default options, tuned for average
// use-cases.
Arena() : impl_(ArenaOptions()) { Init(ArenaOptions()); }
~Arena() {
- if (on_arena_reset_ != NULL || on_arena_destruction_ != NULL) {
+ if (hooks_cookie_) {
CallDestructorHooks();
}
}
@@ -277,6 +299,7 @@ class LIBPROTOBUF_EXPORT Arena {
}
}
#endif
+
template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
static T* CreateMessage(::google::protobuf::Arena* arena) {
#if LANG_CXX11
@@ -355,6 +378,7 @@ class LIBPROTOBUF_EXPORT Arena {
}
}
#endif
+
template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
static T* Create(::google::protobuf::Arena* arena) {
if (arena == NULL) {
@@ -522,6 +546,7 @@ class LIBPROTOBUF_EXPORT Arena {
//
// Combines SpaceAllocated and SpaceUsed. Returns a pair of
// <space_allocated, space_used>.
+ PROTOBUF_RUNTIME_DEPRECATED("Please use SpaceAllocated() and SpaceUsed()")
std::pair<uint64, uint64> SpaceAllocatedAndUsed() const {
return std::make_pair(SpaceAllocated(), SpaceUsed());
}
@@ -637,6 +662,29 @@ class LIBPROTOBUF_EXPORT Arena {
struct is_arena_constructable : InternalHelper<T>::is_arena_constructable {};
private:
+ template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
+ static T* CreateMessageInternal(::google::protobuf::Arena* arena) {
+#if LANG_CXX11
+ static_assert(
+ InternalHelper<T>::is_arena_constructable::value,
+ "CreateMessage can only construct types that are ArenaConstructable");
+#endif
+ if (arena == NULL) {
+ return new T;
+ } else {
+ return arena->CreateMessageInternal<T>();
+ }
+ }
+
+ template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
+ static T* CreateInternal(::google::protobuf::Arena* arena) {
+ if (arena == NULL) {
+ return new T();
+ } else {
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value);
+ }
+ }
+
void CallDestructorHooks();
void OnArenaAllocation(const std::type_info* allocated_type, size_t n) const;
inline void AllocHook(const std::type_info* allocated_type, size_t n) const {
@@ -668,12 +716,12 @@ class LIBPROTOBUF_EXPORT Arena {
// fields, since they are designed to work in all mode combinations.
template <typename Msg> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
static Msg* CreateMaybeMessage(Arena* arena, google::protobuf::internal::true_type) {
- return CreateMessage<Msg>(arena);
+ return CreateMessageInternal<Msg>(arena);
}
template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
static T* CreateMaybeMessage(Arena* arena, google::protobuf::internal::false_type) {
- return Create<T>(arena);
+ return CreateInternal<T>(arena);
}
template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
@@ -907,7 +955,6 @@ class LIBPROTOBUF_EXPORT Arena {
internal::ArenaImpl impl_;
- void* (*on_arena_init_)(Arena* arena);
void (*on_arena_allocation_)(const std::type_info* allocated_type,
uint64 alloc_size, void* cookie);
void (*on_arena_reset_)(Arena* arena, void* cookie, uint64 space_used);
diff --git a/src/google/protobuf/arena_impl.h b/src/google/protobuf/arena_impl.h
index 6cc7096b..439b0969 100644
--- a/src/google/protobuf/arena_impl.h
+++ b/src/google/protobuf/arena_impl.h
@@ -40,10 +40,13 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/mutex.h>
-#include <google/protobuf/stubs/type_traits.h>
#include <google/protobuf/stubs/port.h>
+#ifdef ADDRESS_SANITIZER
+#include <sanitizer/asan_interface.h>
+#endif // ADDRESS_SANITIZER
+
namespace google {
namespace protobuf {
@@ -112,6 +115,10 @@ class LIBPROTOBUF_EXPORT ArenaImpl {
void AddCleanup(void* elem, void (*cleanup)(void*));
private:
+ void* AllocateAlignedFallback(size_t n);
+ void* AllocateAlignedAndAddCleanupFallback(size_t n, void (*cleanup)(void*));
+ void AddCleanupFallback(void* elem, void (*cleanup)(void*));
+
// Node contains the ptr of the object to be cleaned up and the associated
// cleanup function ptr.
struct CleanupNode {
@@ -124,34 +131,107 @@ class LIBPROTOBUF_EXPORT ArenaImpl {
static size_t SizeOf(size_t i) {
return sizeof(CleanupChunk) + (sizeof(CleanupNode) * (i - 1));
}
- size_t len; // Number of elements currently present.
size_t size; // Total elements in the list.
CleanupChunk* next; // Next node in the list.
CleanupNode nodes[1]; // True length is |size|.
};
- struct Block;
+ class Block;
+
+ // A thread-unsafe Arena that can only be used within its owning thread.
+ class LIBPROTOBUF_EXPORT SerialArena {
+ public:
+ // The allocate/free methods here are a little strange, since SerialArena is
+ // allocated inside a Block which it also manages. This is to avoid doing
+ // an extra allocation for the SerialArena itself.
+
+ // Creates a new SerialArena inside Block* and returns it.
+ static SerialArena* New(Block* b, void* owner, ArenaImpl* arena);
+
+ // Destroys this SerialArena, freeing all blocks with the given dealloc
+ // function, except any block equal to |initial_block|.
+ static uint64 Free(SerialArena* serial, Block* initial_block,
+ void (*block_dealloc)(void*, size_t));
+
+ void CleanupList();
+ uint64 SpaceUsed() const;
+
+ void* AllocateAligned(size_t n) {
+ GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n); // Must be already aligned.
+ GOOGLE_DCHECK_GE(limit_, ptr_);
+ if (GOOGLE_PREDICT_FALSE(static_cast<size_t>(limit_ - ptr_) < n)) {
+ return AllocateAlignedFallback(n);
+ }
+ void* ret = ptr_;
+ ptr_ += n;
+#ifdef ADDRESS_SANITIZER
+ ASAN_UNPOISON_MEMORY_REGION(ret, n);
+#endif // ADDRESS_SANITIZER
+ return ret;
+ }
+
+ void AddCleanup(void* elem, void (*cleanup)(void*)) {
+ if (GOOGLE_PREDICT_FALSE(cleanup_ptr_ == cleanup_limit_)) {
+ AddCleanupFallback(elem, cleanup);
+ return;
+ }
+ cleanup_ptr_->elem = elem;
+ cleanup_ptr_->cleanup = cleanup;
+ cleanup_ptr_++;
+ }
+
+ void* AllocateAlignedAndAddCleanup(size_t n, void (*cleanup)(void*)) {
+ void* ret = AllocateAligned(n);
+ AddCleanup(ret, cleanup);
+ return ret;
+ }
- // Tracks per-thread info. ThreadInfos are kept in a linked list.
- struct ThreadInfo {
- void *owner; // &ThreadCache of this thread;
- Block* head; // Head of linked list of blocks.
- CleanupChunk* cleanup; // Head of cleanup list.
- ThreadInfo* next; // Next ThreadInfo in this linked list.
+ void* owner() const { return owner_; }
+ SerialArena* next() const { return next_; }
+ void set_next(SerialArena* next) { next_ = next; }
+
+ private:
+ void* AllocateAlignedFallback(size_t n);
+ void AddCleanupFallback(void* elem, void (*cleanup)(void*));
+ void CleanupListFallback();
+
+ ArenaImpl* arena_; // Containing arena.
+ void* owner_; // &ThreadCache of this thread;
+ Block* head_; // Head of linked list of blocks.
+ CleanupChunk* cleanup_; // Head of cleanup list.
+ SerialArena* next_; // Next SerialArena in this linked list.
+
+ // Next pointer to allocate from. Always 8-byte aligned. Points inside
+ // head_ (and head_->pos will always be non-canonical). We keep these
+ // here to reduce indirection.
+ char* ptr_;
+ char* limit_;
+
+ // Next CleanupList members to append to. These point inside cleanup_.
+ CleanupNode* cleanup_ptr_;
+ CleanupNode* cleanup_limit_;
};
// Blocks are variable length malloc-ed objects. The following structure
// describes the common header for all blocks.
- struct Block {
- void* owner; // &ThreadCache of thread that owns this block.
- ThreadInfo* thread_info; // ThreadInfo of thread that owns this block.
- Block* next; // Next block in arena (may have different owner)
- // ((char*) &block) + pos is next available byte. It is always
- // aligned at a multiple of 8 bytes.
- size_t pos;
- size_t size; // total size of the block.
- GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
- size_t avail() const { return size - pos; }
+ class LIBPROTOBUF_EXPORT Block {
+ public:
+ Block(size_t size, Block* next);
+
+ char* Pointer(size_t n) {
+ GOOGLE_DCHECK(n <= size_);
+ return reinterpret_cast<char*>(this) + n;
+ }
+
+ Block* next() const { return next_; }
+ size_t pos() const { return pos_; }
+ size_t size() const { return size_; }
+ void set_pos(size_t pos) { pos_ = pos; }
+
+ private:
+ Block* next_; // Next block for this thread.
+ size_t pos_;
+ size_t size_;
// data follows
};
@@ -160,13 +240,13 @@ class LIBPROTOBUF_EXPORT ArenaImpl {
// If we are using the ThreadLocalStorage class to store the ThreadCache,
// then the ThreadCache's default constructor has to be responsible for
// initializing it.
- ThreadCache() : last_lifecycle_id_seen(-1), last_block_used_(NULL) {}
+ ThreadCache() : last_lifecycle_id_seen(-1), last_serial_arena(NULL) {}
#endif
// The ThreadCache is considered valid as long as this matches the
// lifecycle_id of the arena being used.
int64 last_lifecycle_id_seen;
- Block* last_block_used_;
+ SerialArena* last_serial_arena;
};
static google::protobuf::internal::SequenceNumber lifecycle_id_generator_;
#if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
@@ -188,38 +268,30 @@ class LIBPROTOBUF_EXPORT ArenaImpl {
// Free all blocks and return the total space used which is the sums of sizes
// of the all the allocated blocks.
uint64 FreeBlocks();
-
- void AddCleanupInBlock(Block* b, void* elem, void (*func)(void*));
- CleanupChunk* ExpandCleanupList(CleanupChunk* cleanup, Block* b);
// Delete or Destruct all objects owned by the arena.
void CleanupList();
- inline void CacheBlock(Block* block) {
- thread_cache().last_block_used_ = block;
+ inline void CacheSerialArena(SerialArena* serial) {
+ thread_cache().last_serial_arena = serial;
thread_cache().last_lifecycle_id_seen = lifecycle_id_;
// TODO(haberman): evaluate whether we would gain efficiency by getting rid
// of hint_. It's the only write we do to ArenaImpl in the allocation path,
// which will dirty the cache line.
- google::protobuf::internal::Release_Store(&hint_, reinterpret_cast<google::protobuf::internal::AtomicWord>(block));
+ google::protobuf::internal::Release_Store(&hint_, reinterpret_cast<google::protobuf::internal::AtomicWord>(serial));
}
- google::protobuf::internal::AtomicWord threads_; // Pointer to a linked list of ThreadInfo.
+ google::protobuf::internal::AtomicWord threads_; // Pointer to a linked list of SerialArena.
google::protobuf::internal::AtomicWord hint_; // Fast thread-local block access
google::protobuf::internal::AtomicWord space_allocated_; // Sum of sizes of all allocated blocks.
Block *initial_block_; // If non-NULL, points to the block that came from
// user data.
- // Returns a block owned by this thread.
- Block* GetBlock(size_t n);
- Block* GetBlockSlow(void* me, Block* my_full_block, size_t n);
- Block* NewBlock(void* me, Block* my_last_block, size_t min_bytes);
- void InitBlock(Block* b, void *me, size_t size);
- static void* AllocFromBlock(Block* b, size_t n);
- ThreadInfo* NewThreadInfo(Block* b);
- ThreadInfo* FindThreadInfo(void* me);
- ThreadInfo* GetThreadInfo(void* me, size_t n);
+ Block* NewBlock(Block* last_block, size_t min_bytes);
+ SerialArena* GetSerialArena();
+ bool GetSerialArenaFast(SerialArena** arena);
+ SerialArena* GetSerialArenaFallback(void* me);
int64 lifecycle_id_; // Unique for each arena. Changes on Reset().
Options options_;
@@ -227,11 +299,15 @@ class LIBPROTOBUF_EXPORT ArenaImpl {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ArenaImpl);
public:
- // kHeaderSize is sizeof(Block), aligned up to the nearest multiple of 8 to
- // protect the invariant that pos is always at a multiple of 8.
- static const size_t kHeaderSize = (sizeof(Block) + 7) & -8;
+ // kBlockHeaderSize is sizeof(Block), aligned up to the nearest multiple of 8
+ // to protect the invariant that pos is always at a multiple of 8.
+ static const size_t kBlockHeaderSize = (sizeof(Block) + 7) & -8;
+ static const size_t kSerialArenaSize = (sizeof(SerialArena) + 7) & -8;
#if LANG_CXX11
- static_assert(kHeaderSize % 8 == 0, "kHeaderSize must be a multiple of 8.");
+ static_assert(kBlockHeaderSize % 8 == 0,
+ "kBlockHeaderSize must be a multiple of 8.");
+ static_assert(kSerialArenaSize % 8 == 0,
+ "kSerialArenaSize must be a multiple of 8.");
#endif
};
diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc
index c6ff25e8..71e28b0c 100644
--- a/src/google/protobuf/arena_unittest.cc
+++ b/src/google/protobuf/arena_unittest.cc
@@ -67,7 +67,6 @@ using protobuf_unittest::TestOneof2;
using protobuf_unittest::TestEmptyMessage;
namespace protobuf {
-namespace {
class Notifier {
public:
@@ -270,7 +269,7 @@ TEST(ArenaTest, InitialBlockTooSmall) {
// Construct a small (64 byte) initial block of memory to be used by the
// arena allocator; then, allocate an object which will not fit in the
// initial block.
- std::vector<char> arena_block(72);
+ std::vector<char> arena_block(96);
ArenaOptions options;
options.initial_block = &arena_block[0];
options.initial_block_size = arena_block.size();
@@ -1299,12 +1298,12 @@ TEST(ArenaTest, SpaceAllocated_and_Used) {
options.initial_block_size = 0;
Arena arena_3(options);
EXPECT_EQ(0, arena_3.SpaceUsed());
- ::google::protobuf::Arena::CreateArray<char>(&arena_3, 182);
+ ::google::protobuf::Arena::CreateArray<char>(&arena_3, 160);
EXPECT_EQ(256, arena_3.SpaceAllocated());
- EXPECT_EQ(Align8(182), arena_3.SpaceUsed());
+ EXPECT_EQ(Align8(160), arena_3.SpaceUsed());
::google::protobuf::Arena::CreateArray<char>(&arena_3, 70);
EXPECT_EQ(256 + 512, arena_3.SpaceAllocated());
- EXPECT_EQ(Align8(182) + Align8(70), arena_3.SpaceUsed());
+ EXPECT_EQ(Align8(160) + Align8(70), arena_3.SpaceUsed());
EXPECT_EQ(256 + 512, arena_3.Reset());
}
@@ -1347,6 +1346,13 @@ TEST(ArenaTest, GetArenaShouldReturnNullForNonArenaAllocatedMessages) {
EXPECT_EQ(NULL, Arena::GetArena(const_pointer_to_message));
}
+TEST(ArenaTest, AddCleanup) {
+ ::google::protobuf::Arena arena;
+ for (int i = 0; i < 100; i++) {
+ arena.Own(new int);
+ }
+}
+
TEST(ArenaTest, UnsafeSetAllocatedOnArena) {
::google::protobuf::Arena arena;
TestAllTypes* message = Arena::CreateMessage<TestAllTypes>(&arena);
@@ -1405,13 +1411,20 @@ uint32 ArenaHooksTestUtil::num_reset = 0;
uint32 ArenaHooksTestUtil::num_destruct = 0;
const int ArenaHooksTestUtil::kCookieValue;
+class ArenaOptionsTestFriend {
+ public:
+ static void Set(::google::protobuf::ArenaOptions* options) {
+ options->on_arena_init = ArenaHooksTestUtil::on_init;
+ options->on_arena_allocation = ArenaHooksTestUtil::on_allocation;
+ options->on_arena_reset = ArenaHooksTestUtil::on_reset;
+ options->on_arena_destruction = ArenaHooksTestUtil::on_destruction;
+ }
+};
+
// Test the hooks are correctly called and that the cookie is passed.
TEST(ArenaTest, ArenaHooksSanity) {
::google::protobuf::ArenaOptions options;
- options.on_arena_init = ArenaHooksTestUtil::on_init;
- options.on_arena_allocation = ArenaHooksTestUtil::on_allocation;
- options.on_arena_reset = ArenaHooksTestUtil::on_reset;
- options.on_arena_destruction = ArenaHooksTestUtil::on_destruction;
+ ArenaOptionsTestFriend::Set(&options);
// Scope for defining the arena
{
@@ -1433,6 +1446,5 @@ TEST(ArenaTest, ArenaHooksSanity) {
}
-} // namespace
} // namespace protobuf
} // namespace google
diff --git a/src/google/protobuf/arenastring.h b/src/google/protobuf/arenastring.h
index c9d045a1..fb1b64a3 100755
--- a/src/google/protobuf/arenastring.h
+++ b/src/google/protobuf/arenastring.h
@@ -51,6 +51,18 @@ namespace google {
namespace protobuf {
namespace internal {
+template <typename T>
+class TaggedPtr {
+ public:
+ void Set(T* p) { ptr_ = reinterpret_cast<uintptr_t>(p); }
+ T* Get() const { return reinterpret_cast<T*>(ptr_); }
+
+ bool IsNull() { return ptr_ == 0; }
+
+ private:
+ uintptr_t ptr_;
+};
+
struct LIBPROTOBUF_EXPORT ArenaStringPtr {
inline void Set(const ::std::string* default_value,
const ::std::string& value, ::google::protobuf::Arena* arena) {
@@ -294,6 +306,15 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
return ptr_ == default_value;
}
+ // Internal accessors!!!!
+ void UnsafeSetTaggedPointer(TaggedPtr< ::std::string> value) {
+ ptr_ = value.Get();
+ }
+ // Generated code only! An optimization, in certain cases the generated
+ // code is certain we can obtain a string with no default checks and
+ // tag tests.
+ ::std::string* UnsafeMutablePointer() { return ptr_; }
+
private:
::std::string* ptr_;
diff --git a/src/google/protobuf/compiler/annotation_test_util.cc b/src/google/protobuf/compiler/annotation_test_util.cc
index aa14faf6..cc8534cc 100644
--- a/src/google/protobuf/compiler/annotation_test_util.cc
+++ b/src/google/protobuf/compiler/annotation_test_util.cc
@@ -76,10 +76,9 @@ void AddFile(const string& filename, const string& data) {
true));
}
-bool CaptureMetadata(const string& filename, const string& plugin_specific_args,
- const string& meta_file_suffix, CommandLineInterface* cli,
- FileDescriptorProto* file,
- std::vector<ExpectedOutput>* outputs) {
+bool RunProtoCompiler(const string& filename,
+ const string& plugin_specific_args,
+ CommandLineInterface* cli, FileDescriptorProto* file) {
cli->SetInputsAreProtoPathRelative(true);
DescriptorCapturingGenerator capturing_generator(file);
@@ -92,24 +91,7 @@ bool CaptureMetadata(const string& filename, const string& plugin_specific_args,
plugin_specific_args.c_str(), capture_out.c_str(),
filename.c_str()};
- if (cli->Run(5, argv) != 0) {
- return false;
- }
-
- if (outputs != NULL) {
- for (std::vector<ExpectedOutput>::iterator i = outputs->begin();
- i != outputs->end(); ++i) {
- GOOGLE_CHECK_OK(File::GetContents(TestTempDir() + "/" + i->file_path,
- &i->file_content, true));
- if (!DecodeMetadata(
- TestTempDir() + "/" + i->file_path + meta_file_suffix,
- &i->file_info)) {
- return false;
- }
- }
- }
-
- return true;
+ return cli->Run(5, argv) == 0;
}
bool DecodeMetadata(const string& path, GeneratedCodeInfo* info) {
diff --git a/src/google/protobuf/compiler/annotation_test_util.h b/src/google/protobuf/compiler/annotation_test_util.h
index 4598a45a..90bd88b3 100644
--- a/src/google/protobuf/compiler/annotation_test_util.h
+++ b/src/google/protobuf/compiler/annotation_test_util.h
@@ -59,25 +59,20 @@ struct ExpectedOutput {
// directory.
void AddFile(const string& filename, const string& data);
-// Tries to capture a FileDescriptorProto, GeneratedCodeInfo, and output
-// code from the previously added file with name `filename`.
+// Runs proto compiler. Captures proto file structrue in FileDescriptorProto.
+// Files will be generated in TestTempDir() folder. Callers of this
+// function must read generated files themselves.
//
// filename: source .proto file used to generate code.
// plugin_specific_args: command line arguments specific to current generator.
// For Java, this value might be "--java_out=annotate_code:test_temp_dir"
-// meta_file_suffix: suffix of meta files that contain annotations. For Java
-// it is ".pb.meta" because for file Foo.java meta file is Foo.java.pb.meta
// cli: instance of command line interface to run generator. See Java's
// annotation_unittest.cc for an example of how to initialize it.
// file: output parameter, will be set to the descriptor of the proto file
// specified in filename.
-// outputs: output parameter. If not NULL, each ExpectedOutput in the vector
-// should have its file_path set; CaptureMetadata will fill the rest of
-// the fields appropriately.
-bool CaptureMetadata(const string& filename, const string& plugin_specific_args,
- const string& meta_file_suffix, CommandLineInterface* cli,
- FileDescriptorProto* file,
- std::vector<ExpectedOutput>* outputs);
+bool RunProtoCompiler(const string& filename,
+ const string& plugin_specific_args,
+ CommandLineInterface* cli, FileDescriptorProto* file);
bool DecodeMetadata(const string& path, GeneratedCodeInfo* info);
diff --git a/src/google/protobuf/compiler/code_generator.h b/src/google/protobuf/compiler/code_generator.h
index 4b1d90b8..4c2b3ee1 100644
--- a/src/google/protobuf/compiler/code_generator.h
+++ b/src/google/protobuf/compiler/code_generator.h
@@ -166,7 +166,7 @@ typedef GeneratorContext OutputDirectory;
// "foo=bar,baz,qux=corge"
// parses to the pairs:
// ("foo", "bar"), ("baz", ""), ("qux", "corge")
-void ParseGeneratorParameter(
+LIBPROTOC_EXPORT void ParseGeneratorParameter(
const string&, std::vector<std::pair<string, string> >*);
} // namespace compiler
diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
index 3d5b5b8d..50c7b5f3 100644
--- a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
@@ -195,7 +195,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
"inline $type$ $classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" if (has_$name$()) {\n"
- " return static_cast< $type$ >($oneof_prefix$$name$_);\n"
+ " return static_cast< $type$ >($field_member$);\n"
" }\n"
" return static_cast< $type$ >($default$);\n"
"}\n"
@@ -209,14 +209,14 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" }\n"
- " $oneof_prefix$$name$_ = value;\n"
+ " $field_member$ = value;\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n");
}
void EnumOneofFieldGenerator::
GenerateClearingCode(io::Printer* printer) const {
- printer->Print(variables_, "$oneof_prefix$$name$_ = $default$;\n");
+ printer->Print(variables_, "$field_member$ = $default$;\n");
}
void EnumOneofFieldGenerator::
diff --git a/src/google/protobuf/compiler/cpp/cpp_field.cc b/src/google/protobuf/compiler/cpp/cpp_field.cc
index f8e11855..0cf25b33 100644
--- a/src/google/protobuf/compiler/cpp/cpp_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_field.cc
@@ -67,12 +67,7 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor,
(*variables)["number"] = SimpleItoa(descriptor->number());
(*variables)["classname"] = ClassName(FieldScope(descriptor), false);
(*variables)["declared_type"] = DeclaredTypeMethodName(descriptor->type());
-
- // non_null_ptr_to_name is usable only if has_$name$ is true. It yields a
- // pointer that will not be NULL. Subclasses of FieldGenerator may set
- // (*variables)["non_null_ptr_to_name"] differently.
- (*variables)["non_null_ptr_to_name"] =
- StrCat("&this->", FieldName(descriptor), "()");
+ (*variables)["field_member"] = FieldName(descriptor) + "_";
(*variables)["tag_size"] = SimpleItoa(
WireFormat::TagSize(descriptor->number(), descriptor->type()));
@@ -81,8 +76,6 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor,
(*variables)["deprecated_attr"] = descriptor->options().deprecated()
? "GOOGLE_PROTOBUF_DEPRECATED_ATTR " : "";
- (*variables)["cppget"] = "Get";
-
if (HasFieldPresence(descriptor->file())) {
(*variables)["set_hasbit"] =
"set_has_" + FieldName(descriptor) + "();";
@@ -93,10 +86,6 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor,
(*variables)["clear_hasbit"] = "";
}
- // By default, empty string, so that generic code used for both oneofs and
- // singular fields can be written.
- (*variables)["oneof_prefix"] = "";
-
// These variables are placeholders to pick out the beginning and ends of
// identifiers for annotations (when doing so with existing variables would
// be ambiguous or impossible). They should never be set to anything but the
@@ -108,10 +97,8 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor,
void SetCommonOneofFieldVariables(const FieldDescriptor* descriptor,
std::map<string, string>* variables) {
const string prefix = descriptor->containing_oneof()->name() + "_.";
- (*variables)["oneof_prefix"] = prefix;
(*variables)["oneof_name"] = descriptor->containing_oneof()->name();
- (*variables)["non_null_ptr_to_name"] =
- StrCat(prefix, (*variables)["name"], "_");
+ (*variables)["field_member"] = StrCat(prefix, (*variables)["name"], "_");
}
FieldGenerator::~FieldGenerator() {}
diff --git a/src/google/protobuf/compiler/cpp/cpp_field.h b/src/google/protobuf/compiler/cpp/cpp_field.h
index 891e30f6..bccfcb9a 100644
--- a/src/google/protobuf/compiler/cpp/cpp_field.h
+++ b/src/google/protobuf/compiler/cpp/cpp_field.h
@@ -184,6 +184,10 @@ class FieldGenerator {
// message's MergeFromCodedStream() method.
virtual void GenerateMergeFromCodedStream(io::Printer* printer) const = 0;
+ // Returns true if this field's "MergeFromCodedStream" code needs the arena
+ // to be defined as a variable.
+ virtual bool MergeFromCodedStreamNeedsArena() const { return false; }
+
// Generate lines to decode this field from a packed value, which will be
// placed inside the message's MergeFromCodedStream() method.
virtual void GenerateMergeFromCodedStreamWithPacking(io::Printer* printer)
diff --git a/src/google/protobuf/compiler/cpp/cpp_file.cc b/src/google/protobuf/compiler/cpp/cpp_file.cc
index 52a16835..a922ee97 100644
--- a/src/google/protobuf/compiler/cpp/cpp_file.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_file.cc
@@ -397,7 +397,7 @@ void FileGenerator::GenerateSourceForMessage(int idx, io::Printer* printer) {
// Define default instances
GenerateSourceDefaultInstance(idx, printer);
- if (UsingImplicitWeakFields(file_, options_)) {
+ if (options_.lite_implicit_weak_fields) {
printer->Print("void $classname$_ReferenceStrong() {}\n", "classname",
message_generators_[idx]->classname_);
}
@@ -416,6 +416,13 @@ void FileGenerator::GenerateSourceForMessage(int idx, io::Printer* printer) {
GenerateInitForSCC(GetSCC(message_generators_[idx]->descriptor_), printer);
}
+
+ printer->Print(
+ "namespace google {\nnamespace protobuf {\n");
+ message_generators_[idx]->GenerateSourceInProto2Namespace(printer);
+ printer->Print(
+ "} // namespace protobuf\n} // namespace google\n");
+
printer->Print(
"\n"
"// @@protoc_insertion_point(global_scope)\n");
@@ -467,7 +474,7 @@ void FileGenerator::GenerateSource(io::Printer* printer) {
// Define default instances
for (int i = 0; i < message_generators_.size(); i++) {
GenerateSourceDefaultInstance(i, printer);
- if (UsingImplicitWeakFields(file_, options_)) {
+ if (options_.lite_implicit_weak_fields) {
printer->Print("void $classname$_ReferenceStrong() {}\n", "classname",
message_generators_[i]->classname_);
}
@@ -525,6 +532,15 @@ void FileGenerator::GenerateSource(io::Printer* printer) {
"\n"
"// @@protoc_insertion_point(namespace_scope)\n");
}
+
+ printer->Print(
+ "namespace google {\nnamespace protobuf {\n");
+ for (int i = 0; i < message_generators_.size(); i++) {
+ message_generators_[i]->GenerateSourceInProto2Namespace(printer);
+ }
+ printer->Print(
+ "} // namespace protobuf\n} // namespace google\n");
+
printer->Print(
"\n"
"// @@protoc_insertion_point(global_scope)\n");
@@ -553,7 +569,42 @@ class FileGenerator::ForwardDeclarations {
std::map<string, const Descriptor*>& classes() { return classes_; }
std::map<string, const EnumDescriptor*>& enums() { return enums_; }
- void Print(io::Printer* printer, const Options& options) const {
+ void PrintForwardDeclarations(io::Printer* printer,
+ const Options& options) const {
+ PrintNestedDeclarations(printer, options);
+ PrintTopLevelDeclarations(printer, options);
+ }
+
+
+ private:
+ void PrintNestedDeclarations(io::Printer* printer,
+ const Options& options) const {
+ PrintDeclarationsInsideNamespace(printer, options);
+ for (std::map<string, ForwardDeclarations *>::const_iterator
+ it = namespaces_.begin(),
+ end = namespaces_.end();
+ it != end; ++it) {
+ printer->Print("namespace $nsname$ {\n",
+ "nsname", it->first);
+ it->second->PrintNestedDeclarations(printer, options);
+ printer->Print("} // namespace $nsname$\n",
+ "nsname", it->first);
+ }
+ }
+
+ void PrintTopLevelDeclarations(io::Printer* printer,
+ const Options& options) const {
+ PrintDeclarationsOutsideNamespace(printer, options);
+ for (std::map<string, ForwardDeclarations *>::const_iterator
+ it = namespaces_.begin(),
+ end = namespaces_.end();
+ it != end; ++it) {
+ it->second->PrintTopLevelDeclarations(printer, options);
+ }
+ }
+
+ void PrintDeclarationsInsideNamespace(io::Printer* printer,
+ const Options& options) const {
for (std::map<string, const EnumDescriptor *>::const_iterator
it = enums_.begin(),
end = enums_.end();
@@ -584,20 +635,36 @@ class FileGenerator::ForwardDeclarations {
"classname", it->first);
}
}
- for (std::map<string, ForwardDeclarations *>::const_iterator
- it = namespaces_.begin(),
- end = namespaces_.end();
+ }
+
+ void PrintDeclarationsOutsideNamespace(io::Printer* printer,
+ const Options& options) const {
+ if (classes_.size() == 0) return;
+
+ printer->Print(
+ "namespace google {\nnamespace protobuf {\n");
+ for (std::map<string, const Descriptor*>::const_iterator
+ it = classes_.begin(),
+ end = classes_.end();
it != end; ++it) {
- printer->Print("namespace $nsname$ {\n",
- "nsname", it->first);
- it->second->Print(printer, options);
- printer->Print("} // namespace $nsname$\n",
- "nsname", it->first);
+ const Descriptor* d = it->second;
+ string extra_class_qualifier;
+ // "class" is to disambiguate in case there is also a function with this
+ // name. There is code out there that does this!
+ printer->Print(
+ "template<> "
+ "$dllexport_decl$"
+ "$class$$classname$* Arena::$func$< $class$$classname$>(Arena*);\n",
+ "classname", QualifiedClassName(d),
+ "func", MessageCreateFunction(d),
+ "class", extra_class_qualifier,
+ "dllexport_decl",
+ options.dllexport_decl.empty() ? "" : options.dllexport_decl + " ");
}
+ printer->Print(
+ "} // namespace protobuf\n} // namespace google\n");
}
-
- private:
std::map<string, ForwardDeclarations*> namespaces_;
std::map<string, const Descriptor*> classes_;
std::map<string, const EnumDescriptor*> enums_;
@@ -1053,7 +1120,7 @@ void FileGenerator::GenerateInitializationCode(io::Printer* printer) {
void FileGenerator::GenerateForwardDeclarations(io::Printer* printer) {
ForwardDeclarations decls;
FillForwardDeclarations(&decls);
- decls.Print(printer, options_);
+ decls.PrintForwardDeclarations(printer, options_);
}
void FileGenerator::FillForwardDeclarations(ForwardDeclarations* decls) {
@@ -1078,8 +1145,8 @@ void FileGenerator::GenerateTopHeaderGuard(io::Printer* printer,
"// Generated by the protocol buffer compiler. DO NOT EDIT!\n"
"// source: $filename$\n"
"\n"
- "#ifndef PROTOBUF_$filename_identifier$__INCLUDED\n"
- "#define PROTOBUF_$filename_identifier$__INCLUDED\n"
+ "#ifndef PROTOBUF_$filename_identifier$_INCLUDED\n"
+ "#define PROTOBUF_$filename_identifier$_INCLUDED\n"
"\n"
"#include <string>\n",
"filename", file_->name(), "filename_identifier", filename_identifier);
@@ -1089,7 +1156,7 @@ void FileGenerator::GenerateTopHeaderGuard(io::Printer* printer,
void FileGenerator::GenerateBottomHeaderGuard(
io::Printer* printer, const string& filename_identifier) {
printer->Print(
- "#endif // PROTOBUF_$filename_identifier$__INCLUDED\n",
+ "#endif // PROTOBUF_$filename_identifier$_INCLUDED\n",
"filename_identifier", filename_identifier);
}
diff --git a/src/google/protobuf/compiler/cpp/cpp_generator.cc b/src/google/protobuf/compiler/cpp/cpp_generator.cc
index e01e5dca..5d8ea300 100644
--- a/src/google/protobuf/compiler/cpp/cpp_generator.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_generator.cc
@@ -41,12 +41,12 @@
#endif
#include <utility>
+#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/compiler/cpp/cpp_file.h>
#include <google/protobuf/compiler/cpp/cpp_helpers.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <google/protobuf/descriptor.pb.h>
-#include <google/protobuf/stubs/strutil.h>
namespace google {
namespace protobuf {
@@ -85,7 +85,6 @@ bool CppGenerator::Generate(const FileDescriptor* file,
// __declspec(dllimport) depending on what is being compiled.
//
Options file_options;
- bool split_source = false;
for (int i = 0; i < options.size(); i++) {
if (options[i].first == "dllexport_decl") {
file_options.dllexport_decl = options[i].second;
@@ -101,18 +100,28 @@ bool CppGenerator::Generate(const FileDescriptor* file,
file_options.enforce_lite = true;
} else if (options[i].first == "lite_implicit_weak_fields") {
file_options.lite_implicit_weak_fields = true;
+ if (!options[i].second.empty()) {
+ file_options.num_cc_files = strto32(options[i].second.c_str(),
+ NULL, 10);
+ }
} else if (options[i].first == "table_driven_parsing") {
file_options.table_driven_parsing = true;
} else if (options[i].first == "table_driven_serialization") {
file_options.table_driven_serialization = true;
- } else if (options[i].first == "split_source") {
- split_source = true;
} else {
*error = "Unknown generator option: " + options[i].first;
return false;
}
}
+ // The safe_boundary_check option controls behavior for Google-internal
+ // protobuf APIs.
+ if (file_options.safe_boundary_check) {
+ *error =
+ "The safe_boundary_check option is not supported outside of Google.";
+ return false;
+ }
+
// -----------------------------------------------------------------
@@ -159,8 +168,8 @@ bool CppGenerator::Generate(const FileDescriptor* file,
}
}
- // Generate cc file.
- if (split_source) {
+ // Generate cc file(s).
+ if (UsingImplicitWeakFields(file, file_options)) {
{
// This is the global .cc file, containing enum/services/tables/reflection
google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
@@ -168,12 +177,26 @@ bool CppGenerator::Generate(const FileDescriptor* file,
io::Printer printer(output.get(), '$');
file_generator.GenerateGlobalSource(&printer);
}
- for (int i = 0; i < file_generator.NumMessages(); i++) {
+
+ int num_cc_files = file_generator.NumMessages();
+
+ // If we're using implicit weak fields then we allow the user to optionally
+ // specify how many files to generate, not counting the global pb.cc file.
+ // If we have more files than messages, then some files will be generated as
+ // empty placeholders.
+ if (file_options.num_cc_files > 0) {
+ GOOGLE_CHECK_LE(file_generator.NumMessages(), file_options.num_cc_files)
+ << "There must be at least as many numbered .cc files as messages.";
+ num_cc_files = file_options.num_cc_files;
+ }
+ for (int i = 0; i < num_cc_files; i++) {
// TODO(gerbens) Agree on naming scheme.
google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
generator_context->Open(basename + "." + SimpleItoa(i) + ".cc"));
io::Printer printer(output.get(), '$');
- file_generator.GenerateSourceForMessage(i, &printer);
+ if (i < file_generator.NumMessages()) {
+ file_generator.GenerateSourceForMessage(i, &printer);
+ }
}
} else {
google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> output(
diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/src/google/protobuf/compiler/cpp/cpp_helpers.cc
index 96950e52..172acedd 100644
--- a/src/google/protobuf/compiler/cpp/cpp_helpers.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_helpers.cc
@@ -752,7 +752,7 @@ bool UsingImplicitWeakFields(const FileDescriptor* file,
bool IsImplicitWeakField(const FieldDescriptor* field, const Options& options) {
return UsingImplicitWeakFields(field->file(), options) &&
field->type() == FieldDescriptor::TYPE_MESSAGE &&
- !field->is_required() && !field->is_repeated() && !field->is_map() &&
+ !field->is_required() && !field->is_map() &&
field->containing_oneof() == NULL;
}
diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.h b/src/google/protobuf/compiler/cpp/cpp_helpers.h
index e0f809c9..4026d0ed 100644
--- a/src/google/protobuf/compiler/cpp/cpp_helpers.h
+++ b/src/google/protobuf/compiler/cpp/cpp_helpers.h
@@ -310,6 +310,10 @@ inline bool IsCrossFileMessage(const FieldDescriptor* field) {
field->message_type()->file() != field->file();
}
+inline string MessageCreateFunction(const Descriptor* d) {
+ return SupportsArenas(d) ? "CreateMessage" : "Create";
+}
+
bool IsAnyMessage(const FileDescriptor* descriptor);
bool IsAnyMessage(const Descriptor* descriptor);
diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc
index 34a70b12..9b2f090e 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message.cc
@@ -325,6 +325,109 @@ bool IsCrossFileMaybeMap(const FieldDescriptor* field) {
return IsCrossFileMessage(field);
}
+bool IsRequired(const std::vector<const FieldDescriptor*>& v) {
+ return v.front()->is_required();
+}
+
+// Allows chunking repeated fields together and non-repeated fields if the
+// fields share the same has_byte index.
+// TODO(seongkim): use lambda with capture instead of functor.
+class MatchRepeatedAndHasByte {
+ public:
+ MatchRepeatedAndHasByte(const std::vector<int>* has_bit_indices,
+ bool has_field_presence)
+ : has_bit_indices_(*has_bit_indices),
+ has_field_presence_(has_field_presence) {}
+
+ // Returns true if the following conditions are met:
+ // --both fields are repeated fields
+ // --both fields are non-repeated fields with either has_field_presence is
+ // false or have the same has_byte index.
+ bool operator()(const FieldDescriptor* a, const FieldDescriptor* b) const {
+ return a->is_repeated() == b->is_repeated() &&
+ (!has_field_presence_ || a->is_repeated() ||
+ has_bit_indices_[a->index()] / 8 ==
+ has_bit_indices_[b->index()] / 8);
+ }
+
+ private:
+ const std::vector<int>& has_bit_indices_;
+ const bool has_field_presence_;
+};
+
+// Allows chunking required fields separately after chunking with
+// MatchRepeatedAndHasByte.
+class MatchRepeatedAndHasByteAndRequired : public MatchRepeatedAndHasByte {
+ public:
+ MatchRepeatedAndHasByteAndRequired(const std::vector<int>* has_bit_indices,
+ bool has_field_presence)
+ : MatchRepeatedAndHasByte(has_bit_indices, has_field_presence) {}
+
+ bool operator()(const FieldDescriptor* a, const FieldDescriptor* b) const {
+ return MatchRepeatedAndHasByte::operator()(a, b) &&
+ a->is_required() == b->is_required();
+ }
+};
+
+// Allows chunking zero-initializable fields separately after chunking with
+// MatchRepeatedAndHasByte.
+class MatchRepeatedAndHasByteAndZeroInits : public MatchRepeatedAndHasByte {
+ public:
+ MatchRepeatedAndHasByteAndZeroInits(const std::vector<int>* has_bit_indices,
+ bool has_field_presence)
+ : MatchRepeatedAndHasByte(has_bit_indices, has_field_presence) {}
+
+ bool operator()(const FieldDescriptor* a, const FieldDescriptor* b) const {
+ return MatchRepeatedAndHasByte::operator()(a, b) &&
+ CanInitializeByZeroing(a) == CanInitializeByZeroing(b);
+ }
+};
+
+// Collects neighboring fields based on a given criteria (equivalent predicate).
+template <typename Predicate>
+std::vector<std::vector<const FieldDescriptor*> > CollectFields(
+ const std::vector<const FieldDescriptor*>& fields,
+ const Predicate& equivalent) {
+ std::vector<std::vector<const FieldDescriptor*> > chunks;
+ if (fields.empty()) {
+ return chunks;
+ }
+
+ const FieldDescriptor* last_field = fields.front();
+ std::vector<const FieldDescriptor*> chunk;
+ for (int i = 0; i < fields.size(); i++) {
+ if (!equivalent(last_field, fields[i]) && !chunk.empty()) {
+ chunks.push_back(chunk);
+ chunk.clear();
+ }
+ chunk.push_back(fields[i]);
+ last_field = fields[i];
+ }
+ if (!chunk.empty()) {
+ chunks.push_back(chunk);
+ }
+ return chunks;
+}
+
+// Returns a bit mask based on has_bit index of "fields" that are typically on
+// the same chunk. It is used in a group presence check where _has_bits_ is
+// masked to tell if any thing in "fields" is present.
+uint32 GenChunkMask(const std::vector<const FieldDescriptor*>& fields,
+ const std::vector<int>& has_bit_indices) {
+ GOOGLE_CHECK(!fields.empty());
+ int first_index_offset = has_bit_indices[fields.front()->index()] / 32;
+ uint32 chunk_mask = 0;
+ for (int i = 0; i < fields.size(); i++) {
+ const FieldDescriptor* field = fields[i];
+ // "index" defines where in the _has_bits_ the field appears.
+ int index = has_bit_indices[field->index()];
+ GOOGLE_CHECK_EQ(first_index_offset, index / 32);
+ chunk_mask |= static_cast<uint32>(1) << (index % 32);
+ }
+ GOOGLE_CHECK_NE(0, chunk_mask);
+ return chunk_mask;
+}
+
} // anonymous namespace
// ===================================================================
@@ -993,6 +1096,7 @@ GenerateClassDefinition(io::Printer* printer) {
vars["new_final"] = " PROTOBUF_FINAL";
+ vars["create_func"] = MessageCreateFunction(descriptor_);
printer->Print(vars,
"void Swap($classname$* other);\n"
"friend void swap($classname$& a, $classname$& b) {\n"
@@ -1001,9 +1105,13 @@ GenerateClassDefinition(io::Printer* printer) {
"\n"
"// implements Message ----------------------------------------------\n"
"\n"
- "inline $classname$* New() const$new_final$ { return New(NULL); }\n"
+ "inline $classname$* New() const$new_final$ {\n"
+ " return ::google::protobuf::Arena::$create_func$<$classname$>(NULL);\n"
+ "}\n"
"\n"
- "$classname$* New(::google::protobuf::Arena* arena) const$new_final$;\n");
+ "$classname$* New(::google::protobuf::Arena* arena) const$new_final$ {\n"
+ " return ::google::protobuf::Arena::$create_func$<$classname$>(arena);\n"
+ "}\n");
// For instances that derive from Message (rather than MessageLite), some
// methods are virtual and should be marked as final.
@@ -2452,112 +2560,125 @@ GenerateStructors(io::Printer* printer) {
}
// Generate the copy constructor.
- printer->Print(
- "$classname$::$classname$(const $classname$& from)\n"
- " : $superclass$()",
- "classname", classname_,
- "superclass", superclass,
- "full_name", descriptor_->full_name());
- printer->Indent();
- printer->Indent();
- printer->Indent();
+ if (UsingImplicitWeakFields(descriptor_->file(), options_)) {
+ // If we are in lite mode and using implicit weak fields, we generate a
+ // one-liner copy constructor that delegates to MergeFrom. This saves some
+ // code size and also cuts down on the complexity of implicit weak fields.
+ // We might eventually want to do this for all lite protos.
+ printer->Print(
+ "$classname$::$classname$(const $classname$& from)\n"
+ " : $classname$() {\n"
+ " MergeFrom(from);\n"
+ "}\n",
+ "classname", classname_);
+ } else {
+ printer->Print(
+ "$classname$::$classname$(const $classname$& from)\n"
+ " : $superclass$()",
+ "classname", classname_,
+ "superclass", superclass,
+ "full_name", descriptor_->full_name());
+ printer->Indent();
+ printer->Indent();
+ printer->Indent();
- printer->Print(
- ",\n_internal_metadata_(NULL)");
+ printer->Print(
+ ",\n_internal_metadata_(NULL)");
- if (HasFieldPresence(descriptor_->file())) {
- printer->Print(",\n_has_bits_(from._has_bits_)");
- }
+ if (HasFieldPresence(descriptor_->file())) {
+ printer->Print(",\n_has_bits_(from._has_bits_)");
+ }
- bool need_to_emit_cached_size = true;
- const string cached_size_decl = ",\n_cached_size_(0)";
- // We reproduce the logic used for laying out _cached_sized_ in the class
- // definition, as to initialize it in-order.
- if (HasFieldPresence(descriptor_->file()) &&
- (HasBitsSize() % 8) != 0) {
- printer->Print(cached_size_decl.c_str());
- need_to_emit_cached_size = false;
- }
+ bool need_to_emit_cached_size = true;
+ const string cached_size_decl = ",\n_cached_size_(0)";
+ // We reproduce the logic used for laying out _cached_sized_ in the class
+ // definition, as to initialize it in-order.
+ if (HasFieldPresence(descriptor_->file()) &&
+ (HasBitsSize() % 8) != 0) {
+ printer->Print(cached_size_decl.c_str());
+ need_to_emit_cached_size = false;
+ }
- std::vector<bool> processed(optimized_order_.size(), false);
- for (int i = 0; i < optimized_order_.size(); ++i) {
- const FieldDescriptor* field = optimized_order_[i];
+ std::vector<bool> processed(optimized_order_.size(), false);
+ for (int i = 0; i < optimized_order_.size(); ++i) {
+ const FieldDescriptor* field = optimized_order_[i];
- if (!(field->is_repeated() && !(field->is_map()))
- ) {
- continue;
- }
+ if (!(field->is_repeated() && !(field->is_map()))
+ ) {
+ continue;
+ }
- processed[i] = true;
- printer->Print(",\n$name$_(from.$name$_)",
- "name", FieldName(field));
- }
+ processed[i] = true;
+ printer->Print(",\n$name$_(from.$name$_)",
+ "name", FieldName(field));
+ }
- if (need_to_emit_cached_size) {
- printer->Print(cached_size_decl.c_str());
- need_to_emit_cached_size = false;
- }
+ if (need_to_emit_cached_size) {
+ printer->Print(cached_size_decl.c_str());
+ need_to_emit_cached_size = false;
+ }
- if (IsAnyMessage(descriptor_)) {
- printer->Print(",\n_any_metadata_(&type_url_, &value_)");
- }
- if (num_weak_fields_ > 0) {
- printer->Print(",\n_weak_field_map_(from._weak_field_map_)");
- }
+ if (IsAnyMessage(descriptor_)) {
+ printer->Print(",\n_any_metadata_(&type_url_, &value_)");
+ }
+ if (num_weak_fields_ > 0) {
+ printer->Print(",\n_weak_field_map_(from._weak_field_map_)");
+ }
- printer->Outdent();
- printer->Outdent();
- printer->Print(" {\n");
+ printer->Outdent();
+ printer->Outdent();
+ printer->Print(" {\n");
- printer->Print(
- "_internal_metadata_.MergeFrom(from._internal_metadata_);\n");
+ printer->Print(
+ "_internal_metadata_.MergeFrom(from._internal_metadata_);\n");
- if (descriptor_->extension_range_count() > 0) {
- printer->Print("_extensions_.MergeFrom(from._extensions_);\n");
- }
+ if (descriptor_->extension_range_count() > 0) {
+ printer->Print("_extensions_.MergeFrom(from._extensions_);\n");
+ }
- GenerateConstructorBody(printer, processed, true);
+ GenerateConstructorBody(printer, processed, true);
- // Copy oneof fields. Oneof field requires oneof case check.
- for (int i = 0; i < descriptor_->oneof_decl_count(); ++i) {
- printer->Print(
- "clear_has_$oneofname$();\n"
- "switch (from.$oneofname$_case()) {\n",
- "oneofname", descriptor_->oneof_decl(i)->name());
- printer->Indent();
- for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) {
- const FieldDescriptor* field = descriptor_->oneof_decl(i)->field(j);
+ // Copy oneof fields. Oneof field requires oneof case check.
+ for (int i = 0; i < descriptor_->oneof_decl_count(); ++i) {
printer->Print(
- "case k$field_name$: {\n",
- "field_name", UnderscoresToCamelCase(field->name(), true));
+ "clear_has_$oneofname$();\n"
+ "switch (from.$oneofname$_case()) {\n",
+ "oneofname", descriptor_->oneof_decl(i)->name());
printer->Indent();
- field_generators_.get(field).GenerateMergingCode(printer);
+ for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) {
+ const FieldDescriptor* field = descriptor_->oneof_decl(i)->field(j);
+ printer->Print(
+ "case k$field_name$: {\n",
+ "field_name", UnderscoresToCamelCase(field->name(), true));
+ printer->Indent();
+ field_generators_.get(field).GenerateMergingCode(printer);
+ printer->Print(
+ "break;\n");
+ printer->Outdent();
+ printer->Print(
+ "}\n");
+ }
printer->Print(
- "break;\n");
+ "case $cap_oneof_name$_NOT_SET: {\n"
+ " break;\n"
+ "}\n",
+ "oneof_index",
+ SimpleItoa(descriptor_->oneof_decl(i)->index()),
+ "cap_oneof_name",
+ ToUpper(descriptor_->oneof_decl(i)->name()));
printer->Outdent();
printer->Print(
"}\n");
}
- printer->Print(
- "case $cap_oneof_name$_NOT_SET: {\n"
- " break;\n"
- "}\n",
- "oneof_index",
- SimpleItoa(descriptor_->oneof_decl(i)->index()),
- "cap_oneof_name",
- ToUpper(descriptor_->oneof_decl(i)->name()));
+
printer->Outdent();
printer->Print(
- "}\n");
+ " // @@protoc_insertion_point(copy_constructor:$full_name$)\n"
+ "}\n"
+ "\n",
+ "full_name", descriptor_->full_name());
}
- printer->Outdent();
- printer->Print(
- " // @@protoc_insertion_point(copy_constructor:$full_name$)\n"
- "}\n"
- "\n",
- "full_name", descriptor_->full_name());
-
// Generate the shared constructor code.
GenerateSharedConstructorCode(printer);
@@ -2610,24 +2731,17 @@ GenerateStructors(io::Printer* printer) {
"}\n\n",
"classname", classname_, "scc_name", scc_name_, "file_namespace",
FileLevelNamespace(descriptor_));
+}
- if (SupportsArenas(descriptor_)) {
- printer->Print(
- "$classname$* $classname$::New(::google::protobuf::Arena* arena) const {\n"
- " return ::google::protobuf::Arena::CreateMessage<$classname$>(arena);\n"
- "}\n",
- "classname", classname_);
- } else {
- printer->Print(
- "$classname$* $classname$::New(::google::protobuf::Arena* arena) const {\n"
- " $classname$* n = new $classname$;\n"
- " if (arena != NULL) {\n"
- " arena->Own(n);\n"
- " }\n"
- " return n;\n"
+void MessageGenerator::GenerateSourceInProto2Namespace(io::Printer* printer) {
+ printer->Print(
+ "template<> "
+ "GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE "
+ "$classname$* Arena::$create_func$< $classname$ >(Arena* arena) {\n"
+ " return Arena::$create_func$Internal< $classname$ >(arena);\n"
"}\n",
- "classname", classname_);
- }
+ "classname", QualifiedClassName(descriptor_),
+ "create_func", MessageCreateFunction(descriptor_));
}
// Return the number of bits set in n, a non-negative integer.
@@ -2681,7 +2795,6 @@ GenerateClear(io::Printer* printer) {
printer->Print("_extensions_.Clear();\n");
}
- int last_i = -1;
int unconditional_budget = kMaxUnconditionalPrimitiveBytesClear;
for (int i = 0; i < optimized_order_.size(); i++) {
const FieldDescriptor* field = optimized_order_[i];
@@ -2693,197 +2806,162 @@ GenerateClear(io::Printer* printer) {
unconditional_budget -= EstimateAlignmentSize(field);
}
- for (int i = 0; i < optimized_order_.size(); ) {
- // Detect infinite loops.
- GOOGLE_CHECK_NE(i, last_i);
- last_i = i;
+ std::vector<std::vector<const FieldDescriptor*> > chunks_frag = CollectFields(
+ optimized_order_,
+ MatchRepeatedAndHasByteAndZeroInits(
+ &has_bit_indices_, HasFieldPresence(descriptor_->file())));
+
+ // Merge next non-zero initializable chunk if it has the same has_byte index
+ // and not meeting unconditional clear condition.
+ std::vector<std::vector<const FieldDescriptor*> > chunks;
+ if (!HasFieldPresence(descriptor_->file())) {
+ // Don't bother with merging without has_bit field.
+ chunks = chunks_frag;
+ } else {
+ // Note that only the next chunk is considered for merging.
+ for (int i = 0; i < chunks_frag.size(); i++) {
+ chunks.push_back(chunks_frag[i]);
+ const FieldDescriptor* field = chunks_frag[i].front();
+ const FieldDescriptor* next_field =
+ (i + 1) < chunks_frag.size() ? chunks_frag[i + 1].front() : NULL;
+ if (CanInitializeByZeroing(field) &&
+ (chunks_frag[i].size() == 1 || unconditional_budget < 0) &&
+ next_field != NULL &&
+ has_bit_indices_[field->index()] / 8 ==
+ has_bit_indices_[next_field->index()] / 8) {
+ GOOGLE_CHECK(!CanInitializeByZeroing(next_field));
+ // Insert next chunk to the current one and skip next chunk.
+ chunks.back().insert(chunks.back().end(), chunks_frag[i + 1].begin(),
+ chunks_frag[i + 1].end());
+ i++;
+ }
+ }
+ }
+
+ for (int chunk_index = 0; chunk_index < chunks.size(); chunk_index++) {
+ std::vector<const FieldDescriptor*>& chunk = chunks[chunk_index];
+ GOOGLE_CHECK(!chunk.empty());
// Step 2: Repeated fields don't use _has_bits_; emit code to clear them
// here.
- for (; i < optimized_order_.size(); i++) {
- const FieldDescriptor* field = optimized_order_[i];
- const FieldGenerator& generator = field_generators_.get(field);
+ if (chunk.front()->is_repeated()) {
+ for (int i = 0; i < chunk.size(); i++) {
+ const FieldDescriptor* field = chunk[i];
+ const FieldGenerator& generator = field_generators_.get(field);
- if (!field->is_repeated()) {
- break;
+ generator.GenerateMessageClearingCode(printer);
}
-
- generator.GenerateMessageClearingCode(printer);
+ continue;
}
- // Step 3: Greedily seek runs of fields that can be cleared by
- // memset-to-0.
- int last_chunk = -1;
- int last_chunk_start = -1;
- int last_chunk_end = -1;
- uint32 last_chunk_mask = 0;
-
+ // Step 3: Non-repeated fields that can be cleared by memset-to-0, then
+ // non-repeated, non-zero initializable fields.
+ int last_chunk = HasFieldPresence(descriptor_->file())
+ ? has_bit_indices_[chunk.front()->index()] / 8
+ : 0;
+ int last_chunk_start = 0;
int memset_run_start = -1;
int memset_run_end = -1;
- for (; i < optimized_order_.size(); i++) {
- const FieldDescriptor* field = optimized_order_[i];
-
- if (!CanInitializeByZeroing(field)) {
- break;
- }
-
- // "index" defines where in the _has_bits_ the field appears.
- // "i" is our loop counter within optimized_order_.
- int index = HasFieldPresence(descriptor_->file()) ?
- has_bit_indices_[field->index()] : 0;
- int chunk = index / 8;
-
- if (last_chunk == -1) {
- last_chunk = chunk;
- last_chunk_start = i;
- } else if (chunk != last_chunk) {
- // Emit the fields for this chunk so far.
- break;
- }
- if (memset_run_start == -1) {
- memset_run_start = i;
+ for (int i = 0; i < chunk.size(); i++) {
+ const FieldDescriptor* field = chunk[i];
+ if (CanInitializeByZeroing(field)) {
+ if (memset_run_start == -1) {
+ memset_run_start = i;
+ }
+ memset_run_end = i;
}
-
- memset_run_end = i;
- last_chunk_end = i;
- last_chunk_mask |= static_cast<uint32>(1) << (index % 32);
}
- if (memset_run_start != memset_run_end && unconditional_budget >= 0) {
- // Flush the memset fields.
- goto flush;
- }
+ const bool have_outer_if =
+ HasFieldPresence(descriptor_->file()) && chunk.size() > 1 &&
+ (memset_run_end != chunk.size() - 1 || unconditional_budget < 0);
- // Step 4: Non-repeated, non-zero initializable fields.
- for (; i < optimized_order_.size(); i++) {
- const FieldDescriptor* field = optimized_order_[i];
- if (field->is_repeated() || CanInitializeByZeroing(field)) {
- break;
- }
+ if (have_outer_if) {
+ uint32 last_chunk_mask = GenChunkMask(chunk, has_bit_indices_);
+ const int count = popcnt(last_chunk_mask);
- // "index" defines where in the _has_bits_ the field appears.
- // "i" is our loop counter within optimized_order_.
- int index = HasFieldPresence(descriptor_->file()) ?
- has_bit_indices_[field->index()] : 0;
- int chunk = index / 8;
+ // 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
+ // _has_bits_[last_chunk * 8 / 32] multiple times.
+ GOOGLE_DCHECK_LE(2, count);
+ GOOGLE_DCHECK_GE(8, count);
- if (last_chunk == -1) {
- last_chunk = chunk;
- last_chunk_start = i;
- } else if (chunk != last_chunk) {
- // Emit the fields for this chunk so far.
- break;
+ if (cached_has_bit_index != last_chunk / 4) {
+ cached_has_bit_index = last_chunk / 4;
+ printer->Print("cached_has_bits = _has_bits_[$idx$];\n", "idx",
+ SimpleItoa(cached_has_bit_index));
}
-
- last_chunk_end = i;
- last_chunk_mask |= static_cast<uint32>(1) << (index % 32);
+ printer->Print("if (cached_has_bits & $mask$u) {\n", "mask",
+ SimpleItoa(last_chunk_mask));
+ printer->Indent();
}
-flush:
-
- if (last_chunk != -1) {
- GOOGLE_DCHECK_NE(-1, last_chunk_start);
- GOOGLE_DCHECK_NE(-1, last_chunk_end);
- GOOGLE_DCHECK_NE(0, last_chunk_mask);
-
- const int count = popcnt(last_chunk_mask);
- const bool have_outer_if = HasFieldPresence(descriptor_->file()) &&
- (last_chunk_start != last_chunk_end) &&
- (memset_run_start != last_chunk_start ||
- memset_run_end != last_chunk_end ||
- unconditional_budget < 0);
-
- if (have_outer_if) {
- // 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
- // _has_bits_[last_chunk * 8 / 32] multiple times.
- GOOGLE_DCHECK_LE(2, count);
- GOOGLE_DCHECK_GE(8, count);
+ if (memset_run_start != -1) {
+ if (memset_run_start == memset_run_end) {
+ // For clarity, do not memset a single field.
+ const FieldGenerator& generator =
+ field_generators_.get(chunk[memset_run_start]);
+ generator.GenerateMessageClearingCode(printer);
+ } else {
+ const string first_field_name = FieldName(chunk[memset_run_start]);
+ const string last_field_name = FieldName(chunk[memset_run_end]);
- if (cached_has_bit_index != last_chunk / 4) {
- cached_has_bit_index = last_chunk / 4;
- printer->Print(
- "cached_has_bits = _has_bits_[$idx$];\n",
- "idx", SimpleItoa(cached_has_bit_index));
- }
printer->Print(
- "if (cached_has_bits & $mask$u) {\n",
- "mask", SimpleItoa(last_chunk_mask));
- printer->Indent();
- }
-
- if (memset_run_start != -1) {
- if (memset_run_start == memset_run_end) {
- // For clarity, do not memset a single field.
- const FieldGenerator& generator =
- field_generators_.get(optimized_order_[memset_run_start]);
- generator.GenerateMessageClearingCode(printer);
- } else {
- const string first_field_name =
- FieldName(optimized_order_[memset_run_start]);
- const string last_field_name =
- FieldName(optimized_order_[memset_run_end]);
-
- printer->Print(
"::memset(&$first$_, 0, static_cast<size_t>(\n"
" reinterpret_cast<char*>(&$last$_) -\n"
" reinterpret_cast<char*>(&$first$_)) + sizeof($last$_));\n",
- "first", first_field_name,
- "last", last_field_name);
- }
-
- // Advance last_chunk_start to skip over the fields we zeroed/memset.
- last_chunk_start = memset_run_end + 1;
+ "first", first_field_name, "last", last_field_name);
}
- // Go back and emit clears for each of the fields we processed.
- for (int j = last_chunk_start; j <= last_chunk_end; j++) {
- const FieldDescriptor* field = optimized_order_[j];
- const string fieldname = FieldName(field);
- const FieldGenerator& generator = field_generators_.get(field);
+ // Advance last_chunk_start to skip over the fields we zeroed/memset.
+ last_chunk_start = memset_run_end + 1;
+ }
+
+ // Go back and emit clears for each of the fields we processed.
+ for (int j = last_chunk_start; j < chunk.size(); j++) {
+ const FieldDescriptor* field = chunk[j];
+ const string fieldname = FieldName(field);
+ const FieldGenerator& generator = field_generators_.get(field);
- // It's faster to just overwrite primitive types, but we should only
- // clear strings and messages if they were set.
- //
- // TODO(kenton): Let the CppFieldGenerator decide this somehow.
- bool should_check_bit =
+ // It's faster to just overwrite primitive types, but we should only
+ // clear strings and messages if they were set.
+ //
+ // TODO(kenton): Let the CppFieldGenerator decide this somehow.
+ bool should_check_bit =
field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ||
field->cpp_type() == FieldDescriptor::CPPTYPE_STRING;
- bool have_enclosing_if = false;
- if (should_check_bit &&
- // If no field presence, then always clear strings/messages as well.
- HasFieldPresence(descriptor_->file())) {
- if (!field->options().weak() &&
- cached_has_bit_index != (has_bit_indices_[field->index()] / 32)) {
- cached_has_bit_index = (has_bit_indices_[field->index()] / 32);
- printer->Print("cached_has_bits = _has_bits_[$new_index$];\n",
- "new_index", SimpleItoa(cached_has_bit_index));
- }
- if (!MaybeGenerateOptionalFieldCondition(printer, field,
- cached_has_bit_index)) {
- printer->Print(
- "if (has_$name$()) {\n",
- "name", fieldname);
- }
- printer->Indent();
- have_enclosing_if = true;
+ bool have_enclosing_if = false;
+ if (should_check_bit &&
+ // If no field presence, then always clear strings/messages as well.
+ HasFieldPresence(descriptor_->file())) {
+ if (!field->options().weak() &&
+ cached_has_bit_index != (has_bit_indices_[field->index()] / 32)) {
+ cached_has_bit_index = (has_bit_indices_[field->index()] / 32);
+ printer->Print("cached_has_bits = _has_bits_[$new_index$];\n",
+ "new_index", SimpleItoa(cached_has_bit_index));
}
-
- generator.GenerateMessageClearingCode(printer);
-
- if (have_enclosing_if) {
- printer->Outdent();
- printer->Print("}\n");
+ if (!MaybeGenerateOptionalFieldCondition(printer, field,
+ cached_has_bit_index)) {
+ printer->Print("if (has_$name$()) {\n", "name", fieldname);
}
+ printer->Indent();
+ have_enclosing_if = true;
}
- if (have_outer_if) {
+ generator.GenerateMessageClearingCode(printer);
+
+ if (have_enclosing_if) {
printer->Outdent();
printer->Print("}\n");
}
}
+
+ if (have_outer_if) {
+ printer->Outdent();
+ printer->Print("}\n");
+ }
}
// Step 4: Unions.
@@ -3349,7 +3427,6 @@ GenerateMergeFromCodedStream(io::Printer* printer) {
"}\n");
return;
}
-
std::vector<const FieldDescriptor*> ordered_fields =
SortFieldsByNumber(descriptor_);
@@ -3379,9 +3456,22 @@ GenerateMergeFromCodedStream(io::Printer* printer) {
return;
}
+ if (SupportsArenas(descriptor_)) {
+ for (int i = 0; i < ordered_fields.size(); i++) {
+ const FieldDescriptor* field = ordered_fields[i];
+ const FieldGenerator& field_generator = field_generators_.get(field);
+ if (field_generator.MergeFromCodedStreamNeedsArena()) {
+ printer->Print(
+ " ::google::protobuf::Arena* arena = GetArenaNoVirtual();\n");
+ break;
+ }
+ }
+ }
+
printer->Print(
- "#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure\n"
- " ::google::protobuf::uint32 tag;\n");
+ "#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto "
+ "failure\n"
+ " ::google::protobuf::uint32 tag;\n");
if (!UseUnknownFieldSet(descriptor_->file(), options_)) {
printer->Print(
@@ -4141,28 +4231,30 @@ GenerateByteSize(io::Printer* printer) {
}
}
- int last_i = -1;
- for (int i = 0; i < optimized_order_.size(); ) {
- // Detect infinite loops.
- GOOGLE_CHECK_NE(i, last_i);
- last_i = i;
+ std::vector<std::vector<const FieldDescriptor*> > chunks = CollectFields(
+ optimized_order_,
+ MatchRepeatedAndHasByteAndRequired(
+ &has_bit_indices_, HasFieldPresence(descriptor_->file())));
- // Skip required fields.
- for (; i < optimized_order_.size() &&
- optimized_order_[i]->is_required(); i++) {
- }
+ // Remove chunks with required fields.
+ chunks.erase(std::remove_if(chunks.begin(), chunks.end(), IsRequired),
+ chunks.end());
+
+ for (int chunk_index = 0; chunk_index < chunks.size(); chunk_index++) {
+ const std::vector<const FieldDescriptor*>& chunk = chunks[chunk_index];
+ GOOGLE_CHECK(!chunk.empty());
// Handle repeated fields.
- for (; i < optimized_order_.size(); i++) {
- const FieldDescriptor* field = optimized_order_[i];
- if (!field->is_repeated()) {
- break;
- }
+ if (chunk.front()->is_repeated()) {
+ for (int i = 0; i < chunk.size(); i++) {
+ const FieldDescriptor* field = chunk[i];
- PrintFieldComment(printer, field);
- const FieldGenerator& generator = field_generators_.get(field);
- generator.GenerateByteSize(printer);
- printer->Print("\n");
+ PrintFieldComment(printer, field);
+ const FieldGenerator& generator = field_generators_.get(field);
+ generator.GenerateByteSize(printer);
+ printer->Print("\n");
+ }
+ continue;
}
// Handle optional (non-repeated/oneof) fields.
@@ -4174,92 +4266,62 @@ GenerateByteSize(io::Printer* printer) {
// descriptor_->field(8), descriptor_->field(9), ...
// descriptor_->field(15),
// etc.
- int last_chunk = -1;
- int last_chunk_start = -1;
- int last_chunk_end = -1;
- uint32 last_chunk_mask = 0;
- for (; i < optimized_order_.size(); i++) {
- const FieldDescriptor* field = optimized_order_[i];
- if (field->is_repeated() || field->is_required()) {
- break;
- }
+ int last_chunk = HasFieldPresence(descriptor_->file())
+ ? has_bit_indices_[chunk.front()->index()] / 8
+ : 0;
+ GOOGLE_DCHECK_NE(-1, last_chunk);
- // "index" defines where in the _has_bits_ the field appears.
- // "i" is our loop counter within optimized_order_.
- int index = HasFieldPresence(descriptor_->file()) ?
- has_bit_indices_[field->index()] : 0;
- int chunk = index / 8;
+ const bool have_outer_if =
+ HasFieldPresence(descriptor_->file()) && chunk.size() > 1;
- if (last_chunk == -1) {
- last_chunk = chunk;
- last_chunk_start = i;
- } else if (chunk != last_chunk) {
- // Emit the fields for this chunk so far.
- break;
- }
+ if (have_outer_if) {
+ uint32 last_chunk_mask = GenChunkMask(chunk, has_bit_indices_);
+ const int count = popcnt(last_chunk_mask);
- last_chunk_end = i;
- last_chunk_mask |= static_cast<uint32>(1) << (index % 32);
- }
+ // 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
+ // _has_bits_[last_chunk * 8 / 32] multiple times.
+ GOOGLE_DCHECK_LE(2, count);
+ GOOGLE_DCHECK_GE(8, count);
- if (last_chunk != -1) {
- GOOGLE_DCHECK_NE(-1, last_chunk_start);
- GOOGLE_DCHECK_NE(-1, last_chunk_end);
- GOOGLE_DCHECK_NE(0, last_chunk_mask);
+ printer->Print("if (_has_bits_[$index$ / 32] & $mask$u) {\n", "index",
+ SimpleItoa(last_chunk * 8), "mask",
+ SimpleItoa(last_chunk_mask));
+ printer->Indent();
+ }
- const int count = popcnt(last_chunk_mask);
- const bool have_outer_if = HasFieldPresence(descriptor_->file()) &&
- (last_chunk_start != last_chunk_end);
+ // Go back and emit checks for each of the fields we processed.
+ for (int j = 0; j < chunk.size(); j++) {
+ const FieldDescriptor* field = chunk[j];
+ const FieldGenerator& generator = field_generators_.get(field);
- if (have_outer_if) {
- // 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
- // _has_bits_[last_chunk * 8 / 32] multiple times.
- GOOGLE_DCHECK_LE(2, count);
- GOOGLE_DCHECK_GE(8, count);
+ PrintFieldComment(printer, field);
- printer->Print(
- "if (_has_bits_[$index$ / 32] & $mask$u) {\n",
- "index", SimpleItoa(last_chunk * 8),
- "mask", SimpleItoa(last_chunk_mask));
+ bool have_enclosing_if = false;
+ if (HasFieldPresence(descriptor_->file())) {
+ printer->Print("if (has_$name$()) {\n", "name", FieldName(field));
printer->Indent();
+ have_enclosing_if = true;
+ } else {
+ // Without field presence: field is serialized only if it has a
+ // non-default value.
+ have_enclosing_if =
+ EmitFieldNonDefaultCondition(printer, "this->", field);
}
- // Go back and emit checks for each of the fields we processed.
- for (int j = last_chunk_start; j <= last_chunk_end; j++) {
- const FieldDescriptor* field = optimized_order_[j];
- const FieldGenerator& generator = field_generators_.get(field);
-
- PrintFieldComment(printer, field);
-
- bool have_enclosing_if = false;
- if (HasFieldPresence(descriptor_->file())) {
- printer->Print(
- "if (has_$name$()) {\n",
- "name", FieldName(field));
- printer->Indent();
- have_enclosing_if = true;
- } else {
- // Without field presence: field is serialized only if it has a
- // non-default value.
- have_enclosing_if = EmitFieldNonDefaultCondition(
- printer, "this->", field);
- }
-
- generator.GenerateByteSize(printer);
+ generator.GenerateByteSize(printer);
- if (have_enclosing_if) {
- printer->Outdent();
- printer->Print(
+ if (have_enclosing_if) {
+ printer->Outdent();
+ printer->Print(
"}\n"
"\n");
- }
}
+ }
- if (have_outer_if) {
- printer->Outdent();
- printer->Print("}\n");
- }
+ if (have_outer_if) {
+ printer->Outdent();
+ printer->Print("}\n");
}
}
@@ -4359,10 +4421,17 @@ GenerateIsInitialized(io::Printer* printer) {
!ShouldIgnoreRequiredFieldCheck(field, options_) &&
scc_analyzer_->HasRequiredFields(field->message_type())) {
if (field->is_repeated()) {
- printer->Print(
- "if (!::google::protobuf::internal::AllAreInitialized(this->$name$()))"
- " return false;\n",
- "name", FieldName(field));
+ if (IsImplicitWeakField(field, options_)) {
+ printer->Print(
+ "if (!::google::protobuf::internal::AllAreInitializedWeak(this->$name$_))"
+ " return false;\n",
+ "name", FieldName(field));
+ } else {
+ printer->Print(
+ "if (!::google::protobuf::internal::AllAreInitialized(this->$name$()))"
+ " return false;\n",
+ "name", FieldName(field));
+ }
} else if (field->options().weak()) {
continue;
} else {
diff --git a/src/google/protobuf/compiler/cpp/cpp_message.h b/src/google/protobuf/compiler/cpp/cpp_message.h
index 0387f0ca..06e2030b 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message.h
+++ b/src/google/protobuf/compiler/cpp/cpp_message.h
@@ -106,6 +106,9 @@ class MessageGenerator {
// Generate all non-inline methods for this class.
void GenerateClassMethods(io::Printer* printer);
+ // Generate source file code that should go outside any namespace.
+ void GenerateSourceInProto2Namespace(io::Printer* printer);
+
private:
// Generate declarations and definitions of accessors for fields.
void GenerateDependentBaseClassDefinition(io::Printer* printer);
diff --git a/src/google/protobuf/compiler/cpp/cpp_message_field.cc b/src/google/protobuf/compiler/cpp/cpp_message_field.cc
index fe60a283..530a6392 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message_field.cc
@@ -80,11 +80,9 @@ void SetMessageVariables(const FieldDescriptor* descriptor,
(*variables)["type_default_instance"] =
DefaultInstanceName(descriptor->message_type());
(*variables)["type_reference_function"] =
- ReferenceFunctionName(descriptor->message_type());
- if (descriptor->options().weak() || !descriptor->containing_oneof()) {
- (*variables)["non_null_ptr_to_name"] =
- StrCat("this->", (*variables)["name"], "_");
- }
+ IsImplicitWeakField(descriptor, options)
+ ? (" " + ReferenceFunctionName(descriptor->message_type()) + "();\n")
+ : "";
(*variables)["stream_writer"] =
(*variables)["declared_type"] +
(HasFastArraySerialization(descriptor->message_type()->file(), options)
@@ -96,14 +94,8 @@ void SetMessageVariables(const FieldDescriptor* descriptor,
SafeFunctionName(descriptor->containing_type(),
descriptor, "release_");
(*variables)["full_name"] = descriptor->full_name();
- if (options.proto_h && IsFieldDependent(descriptor)) {
- (*variables)["dependent_type"] = "T::" + DependentTypeName(descriptor);
- (*variables)["dependent_typename"] =
- "typename T::" + DependentTypeName(descriptor);
- } else {
- (*variables)["dependent_type"] = FieldMessageTypeName(descriptor);
- (*variables)["dependent_typename"] = FieldMessageTypeName(descriptor);
- }
+ (*variables)["create_func"] =
+ MessageCreateFunction(descriptor->message_type());
}
} // namespace
@@ -114,7 +106,6 @@ MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor,
const Options& options)
: FieldGenerator(options),
descriptor_(descriptor),
- dependent_field_(options.proto_h && IsFieldDependent(descriptor)),
implicit_weak_field_(IsImplicitWeakField(descriptor, options)) {
SetMessageVariables(descriptor, &variables_, options);
}
@@ -131,23 +122,7 @@ GeneratePrivateMembers(io::Printer* printer) const {
}
void MessageFieldGenerator::
-GenerateDependentAccessorDeclarations(io::Printer* printer) const {
- if (!dependent_field_) {
- return;
- }
- printer->Print(variables_,
- "$deprecated_attr$$type$* ${$mutable_$name$$}$();\n");
- printer->Annotate("{", "}", descriptor_);
-}
-
-void MessageFieldGenerator::
GenerateAccessorDeclarations(io::Printer* printer) const {
- if (SupportsArenas(descriptor_) && !implicit_weak_field_) {
- printer->Print(variables_,
- "private:\n"
- "void _slow_mutable_$name$();\n"
- "public:\n");
- }
if (implicit_weak_field_) {
// These private accessors are used by MergeFrom and
// MergePartialFromCodedStream, and their purpose is to provide access to
@@ -163,11 +138,9 @@ GenerateAccessorDeclarations(io::Printer* printer) const {
printer->Annotate("name", descriptor_);
printer->Print(variables_, "$deprecated_attr$$type$* $release_name$();\n");
printer->Annotate("release_name", descriptor_);
- if (!dependent_field_) {
- printer->Print(variables_,
- "$deprecated_attr$$type$* ${$mutable_$name$$}$();\n");
- printer->Annotate("{", "}", descriptor_);
- }
+ printer->Print(variables_,
+ "$deprecated_attr$$type$* ${$mutable_$name$$}$();\n");
+ printer->Annotate("{", "}", descriptor_);
printer->Print(variables_,
"$deprecated_attr$void ${$set_allocated_$name$$}$"
"($type$* $name$);\n");
@@ -216,22 +189,9 @@ void MessageFieldGenerator::GenerateNonInlineAccessorDefinitions(
" &$type_default_instance$)->New(GetArenaNoVirtual());\n"
" }\n"
" }\n"
- " return $name$_;\n");
- } else {
- printer->Print(variables_,
- "void $classname$::_slow_mutable_$name$() {\n");
- if (SupportsArenas(descriptor_->message_type())) {
- printer->Print(variables_,
- " $name$_ = ::google::protobuf::Arena::CreateMessage< $type$ >(\n"
- " GetArenaNoVirtual());\n");
- } else {
- printer->Print(variables_,
- " $name$_ = ::google::protobuf::Arena::Create< $type$ >(\n"
- " GetArenaNoVirtual());\n");
- }
+ " return $name$_;\n"
+ "}\n");
}
- printer->Print(variables_,
- "}\n");
printer->Print(variables_,
"void $classname$::unsafe_arena_set_allocated_$name$(\n"
@@ -268,118 +228,38 @@ void MessageFieldGenerator::GenerateNonInlineAccessorDefinitions(
}
void MessageFieldGenerator::
-GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const {
- if (!dependent_field_) {
- return;
- }
-
- std::map<string, string> variables(variables_);
- // For the CRTP base class, all mutation methods are dependent, and so
- // they must be in the header.
- variables["dependent_classname"] =
- DependentBaseClassTemplateName(descriptor_->containing_type()) + "<T>";
- variables["this_message"] = DependentBaseDownCast();
- variables["casted_reference"] =
- ReinterpretCast(variables["dependent_typename"] + "*&",
- variables["this_message"] + variables["name"] + "_",
- implicit_weak_field_);
- if (!variables["set_hasbit"].empty()) {
- variables["set_hasbit"] =
- variables["this_message"] + variables["set_hasbit"];
- }
- if (!variables["clear_hasbit"].empty()) {
- variables["clear_hasbit"] =
- variables["this_message"] + variables["clear_hasbit"];
- }
-
- if (SupportsArenas(descriptor_)) {
- printer->Print(variables,
- "template <class T>\n"
- "inline $type$* $dependent_classname$::mutable_$name$() {\n");
- if (implicit_weak_field_) {
- printer->Print(variables, " $type_reference_function$();\n");
- }
- printer->Print(variables,
- " $set_hasbit$\n"
- " $dependent_typename$*& $name$_ = $casted_reference$;\n"
- " if ($name$_ == NULL) {\n");
- if (implicit_weak_field_) {
- printer->Print(variables,
- " $name$_ = reinterpret_cast<$dependent_typename$*>(\n"
- " reinterpret_cast<const google::protobuf::MessageLite*>(\n"
- " &$type_default_instance$)->New(\n"
- " $this_message$GetArenaNoVirtual()));\n");
- } else {
- printer->Print(variables,
- " $this_message$_slow_mutable_$name$();\n");
- }
- printer->Print(variables,
- " }\n"
- " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
- " return $name$_;\n"
- "}\n");
- } else {
- printer->Print(variables,
- "template <class T>\n"
- "inline $type$* $dependent_classname$::mutable_$name$() {\n"
- " $set_hasbit$\n"
- " $dependent_typename$*& $name$_ = $casted_reference$;\n"
- " if ($name$_ == NULL) {\n"
- " $name$_ = new $dependent_typename$;\n"
- " }\n"
- " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
- " return $name$_;\n"
- "}\n");
- }
-}
-
-void MessageFieldGenerator::
GenerateInlineAccessorDefinitions(io::Printer* printer) const {
- std::map<string, string> variables(variables_);
- variables["const_member"] = ReinterpretCast(
- "const " + variables["type"] + "*", variables["name"] + "_",
- implicit_weak_field_);
- printer->Print(variables,
- "inline const $type$& $classname$::$name$() const {\n");
- if (implicit_weak_field_) {
- printer->Print(variables, " $type_reference_function$();\n");
- }
- printer->Print(variables,
- " const $type$* p = $const_member$;\n"
+ printer->Print(variables_,
+ "inline const $type$& $classname$::$name$() const {\n"
+ "$type_reference_function$"
+ " const $type$* p = $casted_member$;\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" return p != NULL ? *p : *reinterpret_cast<const $type$*>(\n"
" &$type_default_instance$);\n"
"}\n");
- printer->Print(variables,
+ printer->Print(variables_,
"inline $type$* $classname$::$release_name$() {\n"
- " // @@protoc_insertion_point(field_release:$full_name$)\n");
- if (implicit_weak_field_) {
- printer->Print(variables, " $type_reference_function$();\n");
- }
- printer->Print(variables,
+ " // @@protoc_insertion_point(field_release:$full_name$)\n"
+ "$type_reference_function$"
" $clear_hasbit$\n"
" $type$* temp = $casted_member$;\n");
if (SupportsArenas(descriptor_)) {
- printer->Print(variables,
+ printer->Print(variables_,
" if (GetArenaNoVirtual() != NULL) {\n"
" temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL);\n"
" }\n");
}
- printer->Print(variables,
+ printer->Print(variables_,
" $name$_ = NULL;\n"
" return temp;\n"
"}\n");
if (SupportsArenas(descriptor_)) {
- printer->Print(variables,
+ printer->Print(variables_,
"inline $type$* $classname$::unsafe_arena_release_$name$() {\n"
- " // @@protoc_insertion_point("
- "field_unsafe_arena_release:$full_name$)\n");
- if (implicit_weak_field_) {
- printer->Print(variables, " $type_reference_function$();\n");
- }
- printer->Print(variables,
+ " // @@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n"
+ "$type_reference_function$"
" $clear_hasbit$\n"
" $type$* temp = $casted_member$;\n"
" $name$_ = NULL;\n"
@@ -387,71 +267,58 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
"}\n");
}
- if (!dependent_field_) {
- if (SupportsArenas(descriptor_)) {
- printer->Print(variables,
- "inline $type$* $classname$::mutable_$name$() {\n"
- " $set_hasbit$\n"
- " if ($name$_ == NULL) {\n");
- if (implicit_weak_field_) {
- printer->Print(variables,
- " _internal_mutable_$name$();\n");
- } else {
- printer->Print(variables,
- " _slow_mutable_$name$();\n");
- }
- printer->Print(variables,
- " }\n"
- " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
- " return $casted_member$;\n"
- "}\n");
- } else {
- printer->Print(variables,
- "inline $type$* $classname$::mutable_$name$() {\n"
- " $set_hasbit$\n"
- " if ($name$_ == NULL) {\n"
- " $name$_ = new $type$;\n"
- " }\n"
- " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
- " return $casted_member$;\n"
- "}\n");
- }
+ printer->Print(variables_,
+ "inline $type$* $classname$::mutable_$name$() {\n"
+ "$type_reference_function$"
+ " $set_hasbit$\n"
+ " if ($name$_ == NULL) {\n");
+ if (implicit_weak_field_) {
+ printer->Print(variables_,
+ " _internal_mutable_$name$();\n");
+ } else {
+ printer->Print(variables_,
+ " $name$_ = ::google::protobuf::Arena::$create_func$< $type$ >(\n"
+ " GetArenaNoVirtual());\n");
}
-
+ printer->Print(variables_,
+ " }\n"
+ " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
+ " return $casted_member$;\n"
+ "}\n");
// We handle the most common case inline, and delegate less common cases to
// the slow fallback function.
- printer->Print(variables,
+ printer->Print(variables_,
"inline void $classname$::set_allocated_$name$($type$* $name$) {\n"
" ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();\n");
- printer->Print(variables,
+ printer->Print(variables_,
" if (message_arena == NULL) {\n");
if (IsCrossFileMessage(descriptor_)) {
- printer->Print(variables,
+ printer->Print(variables_,
" delete reinterpret_cast< ::google::protobuf::MessageLite*>($name$_);\n");
} else {
- printer->Print(variables,
+ printer->Print(variables_,
" delete $name$_;\n");
}
- printer->Print(variables,
+ printer->Print(variables_,
" }\n"
" if ($name$) {\n");
if (SupportsArenas(descriptor_->message_type()) &&
IsCrossFileMessage(descriptor_)) {
// We have to read the arena through the virtual method, because the type
// isn't defined in this file.
- printer->Print(variables,
+ printer->Print(variables_,
" ::google::protobuf::Arena* submessage_arena =\n"
" reinterpret_cast< ::google::protobuf::MessageLite*>($name$)->GetArena();\n");
} else if (!SupportsArenas(descriptor_->message_type())) {
- printer->Print(variables,
+ printer->Print(variables_,
" ::google::protobuf::Arena* submessage_arena = NULL;\n");
} else {
- printer->Print(variables,
+ printer->Print(variables_,
" ::google::protobuf::Arena* submessage_arena =\n"
" ::google::protobuf::Arena::GetArena($name$);\n");
}
- printer->Print(variables,
+ printer->Print(variables_,
" if (message_arena != submessage_arena) {\n"
" $name$ = ::google::protobuf::internal::GetOwnedMessage(\n"
" message_arena, $name$, submessage_arena);\n"
@@ -461,13 +328,13 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" $clear_hasbit$\n"
" }\n");
if (implicit_weak_field_) {
- printer->Print(variables,
+ printer->Print(variables_,
" $name$_ = reinterpret_cast<MessageLite*>($name$);\n");
} else {
- printer->Print(variables,
+ printer->Print(variables_,
" $name$_ = $name$;\n");
}
- printer->Print(variables,
+ printer->Print(variables_,
" // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
"}\n");
}
@@ -540,34 +407,12 @@ GenerateConstructorCode(io::Printer* printer) const {
void MessageFieldGenerator::
GenerateCopyConstructorCode(io::Printer* printer) const {
- // For non-Arena enabled messages, everything always goes on the heap.
- //
- // For Arena enabled messages, the logic is a bit more convoluted.
- //
- // In the copy constructor, we call InternalMetadataWithArena::MergeFrom,
- // which does *not* copy the Arena pointer. In the generated MergeFrom
- // (see MessageFieldGenerator::GenerateMergingCode), we:
- // -> copy the has bits (but this is done in bulk by a memcpy in the copy
- // constructor)
- // -> check whether the destination field pointer is NULL (it will be, since
- // we're initializing it and would have called SharedCtor) and if so:
- // -> call _slow_mutable_$name$(), which calls either
- // ::google::protobuf::Arena::CreateMessage<>(GetArenaNoVirtual()), or
- // ::google::protobuf::Arena::Create<>(GetArenaNoVirtual())
- //
- // At this point, GetArenaNoVirtual returns NULL since the Arena pointer
- // wasn't copied, so both of these methods allocate the submessage on the
- // heap.
-
- string new_expression = (implicit_weak_field_ ? "from.$name$_->New()"
- : "new $type$(*from.$name$_)");
- string output =
- "if (from.has_$name$()) {\n"
- " $name$_ = " + new_expression + ";\n"
- "} else {\n"
- " $name$_ = NULL;\n"
- "}\n";
- printer->Print(variables_, output.c_str());
+ printer->Print(variables_,
+ "if (from.has_$name$()) {\n"
+ " $name$_ = new $type$(*from.$name$_);\n"
+ "} else {\n"
+ " $name$_ = NULL;\n"
+ "}\n");
}
void MessageFieldGenerator::
@@ -591,7 +436,7 @@ void MessageFieldGenerator::
GenerateSerializeWithCachedSizes(io::Printer* printer) const {
printer->Print(variables_,
"::google::protobuf::internal::WireFormatLite::Write$stream_writer$(\n"
- " $number$, *$non_null_ptr_to_name$, output);\n");
+ " $number$, *$field_member$, output);\n");
}
void MessageFieldGenerator::
@@ -599,7 +444,7 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
printer->Print(variables_,
"target = ::google::protobuf::internal::WireFormatLite::\n"
" InternalWrite$declared_type$ToArray(\n"
- " $number$, *$non_null_ptr_to_name$, deterministic, target);\n");
+ " $number$, *$field_member$, deterministic, target);\n");
}
void MessageFieldGenerator::
@@ -607,7 +452,7 @@ GenerateByteSize(io::Printer* printer) const {
printer->Print(variables_,
"total_size += $tag_size$ +\n"
" ::google::protobuf::internal::WireFormatLite::$declared_type$Size(\n"
- " *$non_null_ptr_to_name$);\n");
+ " *$field_member$);\n");
}
// ===================================================================
@@ -650,57 +495,27 @@ void MessageOneofFieldGenerator::GenerateNonInlineAccessorDefinitions(
" message_arena, $name$, submessage_arena);\n"
" }\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_ = $name$;\n"
+ " $field_member$ = $name$;\n"
" }\n"
" // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
"}\n");
}
void MessageOneofFieldGenerator::
-GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const {
- // For the CRTP base class, all mutation methods are dependent, and so
- // they must be in the header.
- if (!dependent_base_) {
- return;
- }
- std::map<string, string> variables(variables_);
- variables["dependent_classname"] =
- DependentBaseClassTemplateName(descriptor_->containing_type()) + "<T>";
- variables["this_message"] = "reinterpret_cast<T*>(this)->";
- // Const message access is needed for the dependent getter.
- variables["this_const_message"] = "reinterpret_cast<const T*>(this)->";
- variables["tmpl"] = "template <class T>\n";
- variables["field_member"] = variables["this_message"] +
- variables["oneof_prefix"] + variables["name"] +
- "_";
- InternalGenerateInlineAccessorDefinitions(variables, printer);
-}
-
-void MessageOneofFieldGenerator::
GenerateInlineAccessorDefinitions(io::Printer* printer) const {
-
- std::map<string, string> variables(variables_);
- variables["dependent_classname"] = variables["classname"];
- variables["this_message"] = "";
- variables["this_const_message"] = "";
- variables["tmpl"] = "";
- variables["field_member"] =
- variables["oneof_prefix"] + variables["name"] + "_";
- variables["dependent_type"] = variables["type"];
-
- printer->Print(variables,
+ printer->Print(variables_,
"inline $type$* $classname$::$release_name$() {\n"
" // @@protoc_insertion_point(field_release:$full_name$)\n"
- " if ($this_message$has_$name$()) {\n"
- " $this_message$clear_has_$oneof_name$();\n"
+ " if (has_$name$()) {\n"
+ " clear_has_$oneof_name$();\n"
" $type$* temp = $field_member$;\n");
if (SupportsArenas(descriptor_)) {
- printer->Print(variables,
- " if ($this_message$GetArenaNoVirtual() != NULL) {\n"
+ printer->Print(variables_,
+ " if (GetArenaNoVirtual() != NULL) {\n"
" temp = ::google::protobuf::internal::DuplicateIfNonNull(temp, NULL);\n"
" }\n");
}
- printer->Print(variables,
+ printer->Print(variables_,
" $field_member$ = NULL;\n"
" return temp;\n"
" } else {\n"
@@ -708,23 +523,23 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" }\n"
"}\n");
- printer->Print(variables,
+ printer->Print(variables_,
"inline const $type$& $classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
- " return $this_const_message$has_$name$()\n"
- " ? *$this_const_message$$oneof_prefix$$name$_\n"
+ " return has_$name$()\n"
+ " ? *$field_member$\n"
" : *reinterpret_cast< $type$*>(&$type_default_instance$);\n"
"}\n");
if (SupportsArenas(descriptor_)) {
- printer->Print(variables,
- "inline $type$* $dependent_classname$::unsafe_arena_release_$name$() {\n"
+ printer->Print(variables_,
+ "inline $type$* $classname$::unsafe_arena_release_$name$() {\n"
" // @@protoc_insertion_point(field_unsafe_arena_release"
":$full_name$)\n"
- " if ($this_message$has_$name$()) {\n"
- " $this_message$clear_has_$oneof_name$();\n"
- " $type$* temp = $this_message$$oneof_prefix$$name$_;\n"
- " $this_message$$oneof_prefix$$name$_ = NULL;\n"
+ " if (has_$name$()) {\n"
+ " clear_has_$oneof_name$();\n"
+ " $type$* temp = $field_member$;\n"
+ " $field_member$ = NULL;\n"
" return temp;\n"
" } else {\n"
" return NULL;\n"
@@ -738,58 +553,24 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" clear_$oneof_name$();\n"
" if ($name$) {\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_ = $name$;\n"
+ " $field_member$ = $name$;\n"
" }\n"
" // @@protoc_insertion_point(field_unsafe_arena_set_allocated:"
"$full_name$)\n"
"}\n");
}
- if (dependent_base_) {
- return;
- }
-
- InternalGenerateInlineAccessorDefinitions(variables, printer);
-}
-
-void MessageOneofFieldGenerator::InternalGenerateInlineAccessorDefinitions(
- const std::map<string, string>& variables, io::Printer* printer) const {
- if (SupportsArenas(descriptor_)) {
- printer->Print(variables,
- "$tmpl$"
- "inline $type$* $dependent_classname$::mutable_$name$() {\n"
- " if (!$this_message$has_$name$()) {\n"
- " $this_message$clear_$oneof_name$();\n"
- " $this_message$set_has_$name$();\n");
- if (SupportsArenas(descriptor_->message_type())) {
- printer->Print(variables,
- " $field_member$ = \n"
- " ::google::protobuf::Arena::CreateMessage< $dependent_typename$ >(\n"
- " $this_message$GetArenaNoVirtual());\n");
- } else {
- printer->Print(variables,
- " $this_message$$oneof_prefix$$name$_ = \n"
- " ::google::protobuf::Arena::Create< $dependent_typename$ >(\n"
- " $this_message$GetArenaNoVirtual());\n");
- }
- printer->Print(variables,
- " }\n"
- " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
- " return $field_member$;\n"
- "}\n");
- } else {
- printer->Print(variables,
- "$tmpl$"
- "inline $type$* $dependent_classname$::mutable_$name$() {\n"
- " if (!$this_message$has_$name$()) {\n"
- " $this_message$clear_$oneof_name$();\n"
- " $this_message$set_has_$name$();\n"
- " $field_member$ = new $dependent_typename$;\n"
- " }\n"
- " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
- " return $field_member$;\n"
- "}\n");
- }
+ printer->Print(variables_,
+ "inline $type$* $classname$::mutable_$name$() {\n"
+ " if (!has_$name$()) {\n"
+ " clear_$oneof_name$();\n"
+ " set_has_$name$();\n"
+ " $field_member$ = ::google::protobuf::Arena::$create_func$< $type$ >(\n"
+ " GetArenaNoVirtual());\n"
+ " }\n"
+ " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
+ " return $field_member$;\n"
+ "}\n");
}
void MessageOneofFieldGenerator::
@@ -797,11 +578,11 @@ GenerateClearingCode(io::Printer* printer) const {
if (SupportsArenas(descriptor_)) {
printer->Print(variables_,
"if (GetArenaNoVirtual() == NULL) {\n"
- " delete $oneof_prefix$$name$_;\n"
+ " delete $field_member$;\n"
"}\n");
} else {
printer->Print(variables_,
- "delete $oneof_prefix$$name$_;\n");
+ "delete $field_member$;\n");
}
}
@@ -834,7 +615,7 @@ RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator(
: FieldGenerator(options),
descriptor_(descriptor),
dependent_field_(options.proto_h && IsFieldDependent(descriptor)),
- dependent_getter_(dependent_field_ && options.safe_boundary_check) {
+ implicit_weak_field_(IsImplicitWeakField(descriptor, options)) {
SetMessageVariables(descriptor, &variables_, options);
}
@@ -848,30 +629,12 @@ GeneratePrivateMembers(io::Printer* printer) const {
void RepeatedMessageFieldGenerator::
InternalGenerateTypeDependentAccessorDeclarations(io::Printer* printer) const {
- printer->Print(variables_,
- "$deprecated_attr$$type$* ${$mutable_$name$$}$(int index);\n");
- printer->Annotate("{", "}", descriptor_);
printer->Print(variables_, "$deprecated_attr$$type$* ${$add_$name$$}$();\n");
printer->Annotate("{", "}", descriptor_);
- if (dependent_getter_) {
- printer->Print(variables_,
- "$deprecated_attr$const ::google::protobuf::RepeatedPtrField< $type$ >&\n"
- " $name$() const;\n");
- printer->Annotate("name", descriptor_);
- }
- printer->Print(variables_,
- "$deprecated_attr$::google::protobuf::RepeatedPtrField< $type$ >*\n"
- " ${$mutable_$name$$}$();\n");
- printer->Annotate("{", "}", descriptor_);
}
void RepeatedMessageFieldGenerator::
GenerateDependentAccessorDeclarations(io::Printer* printer) const {
- if (dependent_getter_) {
- printer->Print(variables_,
- "$deprecated_attr$const $type$& $name$(int index) const;\n");
- printer->Annotate("name", descriptor_);
- }
if (dependent_field_) {
InternalGenerateTypeDependentAccessorDeclarations(printer);
}
@@ -879,20 +642,24 @@ GenerateDependentAccessorDeclarations(io::Printer* printer) const {
void RepeatedMessageFieldGenerator::
GenerateAccessorDeclarations(io::Printer* printer) const {
- if (!dependent_getter_) {
- printer->Print(variables_,
- "$deprecated_attr$const $type$& $name$(int index) const;\n");
- printer->Annotate("name", descriptor_);
- }
+ printer->Print(variables_,
+ "$deprecated_attr$$type$* ${$mutable_$name$$}$(int index);\n");
+ printer->Annotate("{", "}", descriptor_);
+ printer->Print(variables_,
+ "$deprecated_attr$::google::protobuf::RepeatedPtrField< $type$ >*\n"
+ " ${$mutable_$name$$}$();\n");
+ printer->Annotate("{", "}", descriptor_);
+
+ printer->Print(variables_,
+ "$deprecated_attr$const $type$& $name$(int index) const;\n");
+ printer->Annotate("name", descriptor_);
if (!dependent_field_) {
InternalGenerateTypeDependentAccessorDeclarations(printer);
}
- if (!dependent_getter_) {
- printer->Print(variables_,
- "$deprecated_attr$const ::google::protobuf::RepeatedPtrField< $type$ >&\n"
- " $name$() const;\n");
- printer->Annotate("name", descriptor_);
- }
+ printer->Print(variables_,
+ "$deprecated_attr$const ::google::protobuf::RepeatedPtrField< $type$ >&\n"
+ " $name$() const;\n");
+ printer->Annotate("name", descriptor_);
}
void RepeatedMessageFieldGenerator::
@@ -908,103 +675,97 @@ GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const {
variables["this_message"] = DependentBaseDownCast();
variables["this_const_message"] = DependentBaseConstDownCast();
- if (dependent_getter_) {
- printer->Print(variables,
- "template <class T>\n"
- "inline const $type$& $dependent_classname$::$name$(int index) const {\n"
- " // @@protoc_insertion_point(field_get:$full_name$)\n"
- " return $this_const_message$$name$_.$cppget$(index);\n"
- "}\n");
- }
-
// Generate per-element accessors:
printer->Print(variables,
"template <class T>\n"
- "inline $type$* $dependent_classname$::mutable_$name$(int index) {\n"
- // TODO(dlj): move insertion points
- " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
- " return $this_message$$name$_.Mutable(index);\n"
- "}\n"
- "template <class T>\n"
"inline $type$* $dependent_classname$::add_$name$() {\n"
" // @@protoc_insertion_point(field_add:$full_name$)\n"
+ "$type_reference_function$"
" return $this_message$$name$_.Add();\n"
"}\n");
+}
- if (dependent_getter_) {
- printer->Print(variables,
- "template <class T>\n"
- "inline const ::google::protobuf::RepeatedPtrField< $type$ >&\n"
- "$dependent_classname$::$name$() const {\n"
- " // @@protoc_insertion_point(field_list:$full_name$)\n"
- " return $this_const_message$$name$_;\n"
- "}\n");
- }
-
- // Generate mutable access to the entire list:
- printer->Print(variables,
- "template <class T>\n"
+void RepeatedMessageFieldGenerator::
+GenerateInlineAccessorDefinitions(io::Printer* printer) const {
+ printer->Print(variables_,
+ "inline $type$* $classname$::mutable_$name$(int index) {\n"
+ // TODO(dlj): move insertion points
+ " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
+ "$type_reference_function$"
+ " return $name$_.Mutable(index);\n"
+ "}\n"
"inline ::google::protobuf::RepeatedPtrField< $type$ >*\n"
- "$dependent_classname$::mutable_$name$() {\n"
+ "$classname$::mutable_$name$() {\n"
" // @@protoc_insertion_point(field_mutable_list:$full_name$)\n"
- " return &$this_message$$name$_;\n"
+ "$type_reference_function$"
+ " return &$name$_;\n"
"}\n");
-}
-void RepeatedMessageFieldGenerator::
-GenerateInlineAccessorDefinitions(io::Printer* printer) const {
- if (!dependent_getter_) {
+ if (options_.safe_boundary_check) {
+ printer->Print(variables_,
+ "inline const $type$& $classname$::$name$(int index) const {\n"
+ " // @@protoc_insertion_point(field_get:$full_name$)\n"
+ "$type_reference_function$"
+ " return $name$_.InternalCheckedGet(index,\n"
+ " *reinterpret_cast<const $type$*>(&$type_default_instance$));\n"
+ "}\n");
+ } else {
printer->Print(variables_,
"inline const $type$& $classname$::$name$(int index) const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
- " return $name$_.$cppget$(index);\n"
+ "$type_reference_function$"
+ " return $name$_.Get(index);\n"
"}\n");
}
if (!dependent_field_) {
printer->Print(variables_,
- "inline $type$* $classname$::mutable_$name$(int index) {\n"
- // TODO(dlj): move insertion points
- " // @@protoc_insertion_point(field_mutable:$full_name$)\n"
- " return $name$_.Mutable(index);\n"
- "}\n"
"inline $type$* $classname$::add_$name$() {\n"
" // @@protoc_insertion_point(field_add:$full_name$)\n"
+ "$type_reference_function$"
" return $name$_.Add();\n"
"}\n");
}
- if (!dependent_field_) {
- printer->Print(variables_,
- "inline ::google::protobuf::RepeatedPtrField< $type$ >*\n"
- "$classname$::mutable_$name$() {\n"
- " // @@protoc_insertion_point(field_mutable_list:$full_name$)\n"
- " return &$name$_;\n"
- "}\n");
- }
- if (!dependent_getter_) {
- printer->Print(variables_,
- "inline const ::google::protobuf::RepeatedPtrField< $type$ >&\n"
- "$classname$::$name$() const {\n"
- " // @@protoc_insertion_point(field_list:$full_name$)\n"
- " return $name$_;\n"
- "}\n");
- }
+ printer->Print(variables_,
+ "inline const ::google::protobuf::RepeatedPtrField< $type$ >&\n"
+ "$classname$::$name$() const {\n"
+ " // @@protoc_insertion_point(field_list:$full_name$)\n"
+ "$type_reference_function$"
+ " return $name$_;\n"
+ "}\n");
}
void RepeatedMessageFieldGenerator::
GenerateClearingCode(io::Printer* printer) const {
- printer->Print(variables_, "$name$_.Clear();\n");
+ if (implicit_weak_field_) {
+ printer->Print(
+ variables_,
+ "CastToBase(&$name$_)->Clear<"
+ "::google::protobuf::internal::ImplicitWeakTypeHandler<$type$>>();\n");
+ } else {
+ printer->Print(variables_, "$name$_.Clear();\n");
+ }
}
void RepeatedMessageFieldGenerator::
GenerateMergingCode(io::Printer* printer) const {
- printer->Print(variables_, "$name$_.MergeFrom(from.$name$_);\n");
+ if (implicit_weak_field_) {
+ printer->Print(
+ variables_,
+ "CastToBase(&$name$_)->MergeFrom<"
+ "::google::protobuf::internal::ImplicitWeakTypeHandler<$type$>>(CastToBase("
+ "from.$name$_));\n");
+ } else {
+ printer->Print(variables_, "$name$_.MergeFrom(from.$name$_);\n");
+ }
}
void RepeatedMessageFieldGenerator::
GenerateSwappingCode(io::Printer* printer) const {
- printer->Print(variables_, "$name$_.InternalSwap(&other->$name$_);\n");
+ printer->Print(
+ variables_,
+ "CastToBase(&$name$_)->InternalSwap(CastToBase(&other->$name$_));\n");
}
void RepeatedMessageFieldGenerator::
@@ -1015,9 +776,18 @@ GenerateConstructorCode(io::Printer* printer) const {
void RepeatedMessageFieldGenerator::
GenerateMergeFromCodedStream(io::Printer* printer) const {
if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) {
- printer->Print(variables_,
- "DO_(::google::protobuf::internal::WireFormatLite::"
- "ReadMessage(input, add_$name$()));\n");
+ if (implicit_weak_field_) {
+ printer->Print(variables_,
+ "DO_(::google::protobuf::internal::WireFormatLite::"
+ "ReadMessage(input, CastToBase(&$name$_)->AddWeak(\n"
+ " reinterpret_cast<const ::google::protobuf::MessageLite*>(\n"
+ " &$type_default_instance$))));\n");
+ } else {
+ printer->Print(variables_,
+ "DO_(::google::protobuf::internal::WireFormatLite::"
+ "ReadMessage(\n"
+ " input, add_$name$()));\n");
+ }
} else {
printer->Print(variables_,
"DO_(::google::protobuf::internal::WireFormatLite::"
@@ -1031,7 +801,19 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const {
"for (unsigned int i = 0,\n"
" n = static_cast<unsigned int>(this->$name$_size()); i < n; i++) {\n"
" ::google::protobuf::internal::WireFormatLite::Write$stream_writer$(\n"
- " $number$, this->$name$(static_cast<int>(i)), output);\n"
+ " $number$,\n");
+ if (implicit_weak_field_) {
+ printer->Print(
+ variables_,
+ " CastToBase($name$_).Get<"
+ "::google::protobuf::internal::ImplicitWeakTypeHandler<$type$>>("
+ "static_cast<int>(i)),\n");
+ } else {
+ printer->Print(variables_,
+ " this->$name$(static_cast<int>(i)),\n");
+ }
+ printer->Print(variables_,
+ " output);\n"
"}\n");
}
@@ -1056,9 +838,18 @@ GenerateByteSize(io::Printer* printer) const {
"total_size += $tag_size$UL * count;\n"
"for (unsigned int i = 0; i < count; i++) {\n"
" total_size +=\n"
- " ::google::protobuf::internal::WireFormatLite::$declared_type$Size(\n"
- " this->$name$(static_cast<int>(i)));\n"
- "}\n");
+ " ::google::protobuf::internal::WireFormatLite::$declared_type$Size(\n");
+ if (implicit_weak_field_) {
+ printer->Print(
+ variables_,
+ " CastToBase($name$_).Get<"
+ "::google::protobuf::internal::ImplicitWeakTypeHandler<$type$>>("
+ "static_cast<int>(i)));\n");
+ } else {
+ printer->Print(variables_,
+ " this->$name$(static_cast<int>(i)));\n");
+ }
+ printer->Print(variables_, "}\n");
printer->Outdent();
printer->Print("}\n");
}
diff --git a/src/google/protobuf/compiler/cpp/cpp_message_field.h b/src/google/protobuf/compiler/cpp/cpp_message_field.h
index 3be505e3..e165404f 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message_field.h
+++ b/src/google/protobuf/compiler/cpp/cpp_message_field.h
@@ -54,9 +54,7 @@ class MessageFieldGenerator : public FieldGenerator {
// implements FieldGenerator ---------------------------------------
void GeneratePrivateMembers(io::Printer* printer) const;
- void GenerateDependentAccessorDeclarations(io::Printer* printer) const;
void GenerateAccessorDeclarations(io::Printer* printer) const;
- void GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
@@ -73,7 +71,6 @@ class MessageFieldGenerator : public FieldGenerator {
protected:
const FieldDescriptor* descriptor_;
- const bool dependent_field_;
const bool implicit_weak_field_;
std::map<string, string> variables_;
@@ -88,7 +85,6 @@ class MessageOneofFieldGenerator : public MessageFieldGenerator {
~MessageOneofFieldGenerator();
// implements FieldGenerator ---------------------------------------
- void GenerateDependentInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const;
void GenerateClearingCode(io::Printer* printer) const;
@@ -101,9 +97,6 @@ class MessageOneofFieldGenerator : public MessageFieldGenerator {
void GenerateConstructorCode(io::Printer* printer) const;
private:
- void InternalGenerateInlineAccessorDefinitions(
- const std::map<string, string>& variables, io::Printer* printer) const;
-
const bool dependent_base_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageOneofFieldGenerator);
};
@@ -136,7 +129,7 @@ class RepeatedMessageFieldGenerator : public FieldGenerator {
const FieldDescriptor* descriptor_;
const bool dependent_field_;
- const bool dependent_getter_;
+ const bool implicit_weak_field_;
std::map<string, string> variables_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator);
diff --git a/src/google/protobuf/compiler/cpp/cpp_options.h b/src/google/protobuf/compiler/cpp/cpp_options.h
index 4a29ad0e..b0dd8836 100644
--- a/src/google/protobuf/compiler/cpp/cpp_options.h
+++ b/src/google/protobuf/compiler/cpp/cpp_options.h
@@ -54,6 +54,7 @@ struct Options {
table_driven_parsing(false),
table_driven_serialization(false),
lite_implicit_weak_fields(false),
+ num_cc_files(0),
access_info_map(NULL) {}
string dllexport_decl;
@@ -65,6 +66,7 @@ struct Options {
bool table_driven_parsing;
bool table_driven_serialization;
bool lite_implicit_weak_fields;
+ int num_cc_files;
string annotation_pragma_name;
string annotation_guard_name;
const AccessInfoMap* access_info_map;
diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
index bc2d02ea..701f9d2d 100644
--- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
@@ -215,7 +215,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
"inline $type$ $classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" if (has_$name$()) {\n"
- " return $oneof_prefix$$name$_;\n"
+ " return $field_member$;\n"
" }\n"
" return $default$;\n"
"}\n"
@@ -224,14 +224,14 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
" }\n"
- " $oneof_prefix$$name$_ = value;\n"
+ " $field_member$ = value;\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n");
}
void PrimitiveOneofFieldGenerator::
GenerateClearingCode(io::Printer* printer) const {
- printer->Print(variables_, "$oneof_prefix$$name$_ = $default$;\n");
+ printer->Print(variables_, "$field_member$ = $default$;\n");
}
void PrimitiveOneofFieldGenerator::
@@ -251,7 +251,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
"clear_$oneof_name$();\n"
"DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n"
" $type$, $wire_format_field_type$>(\n"
- " input, &$oneof_prefix$$name$_)));\n"
+ " input, &$field_member$)));\n"
"set_has_$name$();\n");
}
diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
index 264f6124..c9901e84 100644
--- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
@@ -402,11 +402,11 @@ GenerateMessageClearingCode(io::Printer* printer) const {
// When Arenas are disabled and field presence has been checked, we can
// safely treat the ArenaStringPtr as a string*.
if (descriptor_->default_value_string().empty()) {
- printer->Print(variables_,
- "(*$name$_.UnsafeRawStringPointer())->clear();\n");
+ printer->Print(variables_, "$name$_.UnsafeMutablePointer()->clear();\n");
} else {
- printer->Print(variables_,
- "(*$name$_.UnsafeRawStringPointer())->assign(*$default_variable$);\n");
+ printer->Print(
+ variables_,
+ "$name$_.UnsafeMutablePointer()->assign(*$default_variable$);\n");
}
} else {
if (descriptor_->default_value_string().empty()) {
@@ -504,6 +504,11 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
}
}
+bool StringFieldGenerator::
+MergeFromCodedStreamNeedsArena() const {
+ return false;
+}
+
void StringFieldGenerator::
GenerateSerializeWithCachedSizes(io::Printer* printer) const {
if (descriptor_->type() == FieldDescriptor::TYPE_STRING) {
@@ -559,7 +564,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
"inline const ::std::string& $classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" if (has_$name$()) {\n"
- " return $oneof_prefix$$name$_.Get();\n"
+ " return $field_member$.Get();\n"
" }\n"
" return *$default_variable$;\n"
"}\n"
@@ -567,9 +572,9 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
+ " $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $oneof_prefix$$name$_.Set$lite$($default_variable$, value,\n"
+ " $field_member$.Set$lite$($default_variable$, value,\n"
" GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
@@ -579,9 +584,9 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
+ " $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $oneof_prefix$$name$_.Set$lite$(\n"
+ " $field_member$.Set$lite$(\n"
" $default_variable$, ::std::move(value), GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n"
"}\n"
@@ -591,9 +596,9 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
+ " $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $oneof_prefix$$name$_.Set$lite$($default_variable$,\n"
+ " $field_member$.Set$lite$($default_variable$,\n"
" $string_piece$(value), GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_set_char:$full_name$)\n"
"}\n"
@@ -603,9 +608,9 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
+ " $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $oneof_prefix$$name$_.Set$lite$(\n"
+ " $field_member$.Set$lite$(\n"
" $default_variable$, $string_piece$(\n"
" reinterpret_cast<const char*>(value), size),\n"
" GetArenaNoVirtual());\n"
@@ -615,9 +620,9 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
+ " $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " return $oneof_prefix$$name$_.Mutable($default_variable$,\n"
+ " return $field_member$.Mutable($default_variable$,\n"
" GetArenaNoVirtual());\n"
" // @@protoc_insertion_point(field_mutable:$full_name$)\n"
"}\n"
@@ -625,7 +630,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" // @@protoc_insertion_point(field_release:$full_name$)\n"
" if (has_$name$()) {\n"
" clear_has_$oneof_name$();\n"
- " return $oneof_prefix$$name$_.Release($default_variable$,\n"
+ " return $field_member$.Release($default_variable$,\n"
" GetArenaNoVirtual());\n"
" } else {\n"
" return NULL;\n"
@@ -633,12 +638,12 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
"}\n"
"inline void $classname$::set_allocated_$name$(::std::string* $name$) {\n"
" if (!has_$name$()) {\n"
- " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
+ " $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
" clear_$oneof_name$();\n"
" if ($name$ != NULL) {\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_.SetAllocated($default_variable$, $name$,\n"
+ " $field_member$.SetAllocated($default_variable$, $name$,\n"
" GetArenaNoVirtual());\n"
" }\n"
" // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
@@ -649,7 +654,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);\n"
" if (has_$name$()) {\n"
" clear_has_$oneof_name$();\n"
- " return $oneof_prefix$$name$_.UnsafeArenaRelease(\n"
+ " return $field_member$.UnsafeArenaRelease(\n"
" $default_variable$, GetArenaNoVirtual());\n"
" } else {\n"
" return NULL;\n"
@@ -659,12 +664,12 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
"::std::string* $name$) {\n"
" GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);\n"
" if (!has_$name$()) {\n"
- " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
+ " $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
" clear_$oneof_name$();\n"
" if ($name$) {\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_.UnsafeArenaSetAllocated($default_variable$, "
+ " $field_member$.UnsafeArenaSetAllocated($default_variable$, "
"$name$, GetArenaNoVirtual());\n"
" }\n"
" // @@protoc_insertion_point(field_unsafe_arena_set_allocated:"
@@ -677,7 +682,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
"inline const ::std::string& $classname$::$name$() const {\n"
" // @@protoc_insertion_point(field_get:$full_name$)\n"
" if (has_$name$()) {\n"
- " return $oneof_prefix$$name$_.GetNoArena();\n"
+ " return $field_member$.GetNoArena();\n"
" }\n"
" return *$default_variable$;\n"
"}\n"
@@ -686,9 +691,9 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
+ " $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $oneof_prefix$$name$_.SetNoArena($default_variable$, value);\n"
+ " $field_member$.SetNoArena($default_variable$, value);\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"#if LANG_CXX11\n"
@@ -697,10 +702,9 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
+ " $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $oneof_prefix$$name$_.SetNoArena(\n"
- " $default_variable$, ::std::move(value));\n"
+ " $field_member$.SetNoArena($default_variable$, ::std::move(value));\n"
" // @@protoc_insertion_point(field_set_rvalue:$full_name$)\n"
"}\n"
"#endif\n"
@@ -709,9 +713,9 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
+ " $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $oneof_prefix$$name$_.SetNoArena($default_variable$,\n"
+ " $field_member$.SetNoArena($default_variable$,\n"
" $string_piece$(value));\n"
" // @@protoc_insertion_point(field_set_char:$full_name$)\n"
"}\n"
@@ -721,10 +725,9 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
+ " $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
- " $oneof_prefix$$name$_.SetNoArena($default_variable$, "
- "$string_piece$(\n"
+ " $field_member$.SetNoArena($default_variable$, $string_piece$(\n"
" reinterpret_cast<const char*>(value), size));\n"
" // @@protoc_insertion_point(field_set_pointer:$full_name$)\n"
"}\n"
@@ -732,29 +735,28 @@ GenerateInlineAccessorDefinitions(io::Printer* printer) const {
" if (!has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
+ " $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
" // @@protoc_insertion_point(field_mutable:$full_name$)\n"
- " return $oneof_prefix$$name$_.MutableNoArena($default_variable$);\n"
+ " return $field_member$.MutableNoArena($default_variable$);\n"
"}\n"
"inline ::std::string* $classname$::$release_name$() {\n"
" // @@protoc_insertion_point(field_release:$full_name$)\n"
" if (has_$name$()) {\n"
" clear_has_$oneof_name$();\n"
- " return $oneof_prefix$$name$_.ReleaseNoArena($default_variable$);\n"
+ " return $field_member$.ReleaseNoArena($default_variable$);\n"
" } else {\n"
" return NULL;\n"
" }\n"
"}\n"
"inline void $classname$::set_allocated_$name$(::std::string* $name$) {\n"
" if (!has_$name$()) {\n"
- " $oneof_prefix$$name$_.UnsafeSetDefault($default_variable$);\n"
+ " $field_member$.UnsafeSetDefault($default_variable$);\n"
" }\n"
" clear_$oneof_name$();\n"
" if ($name$ != NULL) {\n"
" set_has_$name$();\n"
- " $oneof_prefix$$name$_.SetAllocatedNoArena($default_variable$,\n"
- " $name$);\n"
+ " $field_member$.SetAllocatedNoArena($default_variable$, $name$);\n"
" }\n"
" // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
"}\n");
@@ -765,12 +767,11 @@ void StringOneofFieldGenerator::
GenerateClearingCode(io::Printer* printer) const {
if (SupportsArenas(descriptor_)) {
printer->Print(variables_,
- "$oneof_prefix$$name$_.Destroy($default_variable$,\n"
+ "$field_member$.Destroy($default_variable$,\n"
" GetArenaNoVirtual());\n");
} else {
printer->Print(variables_,
- "$oneof_prefix$$name$_."
- "DestroyNoArena($default_variable$);\n");
+ "$field_member$.DestroyNoArena($default_variable$);\n");
}
}
@@ -796,7 +797,7 @@ void StringOneofFieldGenerator::
GenerateDestructorCode(io::Printer* printer) const {
printer->Print(variables_,
"if (has_$name$()) {\n"
- " $oneof_prefix$$name$_.DestroyNoArena($default_variable$);\n"
+ " $field_member$.DestroyNoArena($default_variable$);\n"
"}\n");
}
@@ -912,11 +913,21 @@ GenerateAccessorDeclarations(io::Printer* printer) const {
void RepeatedStringFieldGenerator::
GenerateInlineAccessorDefinitions(io::Printer* printer) const {
+ if (options_.safe_boundary_check) {
+ printer->Print(variables_,
+ "inline const ::std::string& $classname$::$name$(int index) const {\n"
+ " // @@protoc_insertion_point(field_get:$full_name$)\n"
+ " return $name$_.InternalCheckedGet(\n"
+ " index, ::google::protobuf::internal::GetEmptyStringAlreadyInited());\n"
+ "}\n");
+ } else {
+ printer->Print(variables_,
+ "inline const ::std::string& $classname$::$name$(int index) const {\n"
+ " // @@protoc_insertion_point(field_get:$full_name$)\n"
+ " return $name$_.Get(index);\n"
+ "}\n");
+ }
printer->Print(variables_,
- "inline const ::std::string& $classname$::$name$(int index) const {\n"
- " // @@protoc_insertion_point(field_get:$full_name$)\n"
- " return $name$_.$cppget$(index);\n"
- "}\n"
"inline ::std::string* $classname$::mutable_$name$(int index) {\n"
" // @@protoc_insertion_point(field_mutable:$full_name$)\n"
" return $name$_.Mutable(index);\n"
@@ -991,7 +1002,8 @@ GenerateMergingCode(io::Printer* printer) const {
void RepeatedStringFieldGenerator::
GenerateSwappingCode(io::Printer* printer) const {
- printer->Print(variables_, "$name$_.InternalSwap(&other->$name$_);\n");
+ printer->Print(variables_,
+ "$name$_.InternalSwap(CastToBase(&other->$name$_));\n");
}
void RepeatedStringFieldGenerator::
diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.h b/src/google/protobuf/compiler/cpp/cpp_string_field.h
index f56f0721..0c6e9ced 100644
--- a/src/google/protobuf/compiler/cpp/cpp_string_field.h
+++ b/src/google/protobuf/compiler/cpp/cpp_string_field.h
@@ -69,6 +69,8 @@ class StringFieldGenerator : public FieldGenerator {
void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const;
void GenerateByteSize(io::Printer* printer) const;
+ bool MergeFromCodedStreamNeedsArena() const;
+
protected:
const FieldDescriptor* descriptor_;
std::map<string, string> variables_;
diff --git a/src/google/protobuf/compiler/cpp/cpp_unittest.cc b/src/google/protobuf/compiler/cpp/cpp_unittest.cc
index 61cc32a4..2ad7ea4e 100644
--- a/src/google/protobuf/compiler/cpp/cpp_unittest.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_unittest.cc
@@ -995,75 +995,76 @@ TEST(GeneratedMessageTest, TestEmbedOptimizedForSize) {
TEST(GeneratedMessageTest, TestSpaceUsed) {
unittest::TestAllTypes message1;
- // sizeof provides a lower bound on SpaceUsed().
- EXPECT_LE(sizeof(unittest::TestAllTypes), message1.SpaceUsed());
- const int empty_message_size = message1.SpaceUsed();
+ // sizeof provides a lower bound on SpaceUsedLong().
+ EXPECT_LE(sizeof(unittest::TestAllTypes), message1.SpaceUsedLong());
+ const size_t empty_message_size = message1.SpaceUsedLong();
// Setting primitive types shouldn't affect the space used.
message1.set_optional_int32(123);
message1.set_optional_int64(12345);
message1.set_optional_uint32(123);
message1.set_optional_uint64(12345);
- EXPECT_EQ(empty_message_size, message1.SpaceUsed());
+ EXPECT_EQ(empty_message_size, message1.SpaceUsedLong());
// On some STL implementations, setting the string to a small value should
- // only increase SpaceUsed() by the size of a string object, though this is
- // not true everywhere.
+ // only increase SpaceUsedLong() by the size of a string object, though this
+ // is not true everywhere.
message1.set_optional_string("abc");
- EXPECT_LE(empty_message_size + sizeof(string), message1.SpaceUsed());
+ EXPECT_LE(empty_message_size + sizeof(string), message1.SpaceUsedLong());
// Setting a string to a value larger than the string object itself should
- // increase SpaceUsed(), because it cannot store the value internally.
+ // increase SpaceUsedLong(), because it cannot store the value internally.
message1.set_optional_string(string(sizeof(string) + 1, 'x'));
int min_expected_increase = message1.optional_string().capacity() +
sizeof(string);
EXPECT_LE(empty_message_size + min_expected_increase,
- message1.SpaceUsed());
+ message1.SpaceUsedLong());
- int previous_size = message1.SpaceUsed();
+ size_t previous_size = message1.SpaceUsedLong();
// Adding an optional message should increase the size by the size of the
// nested message type. NestedMessage is simple enough (1 int field) that it
// is equal to sizeof(NestedMessage)
message1.mutable_optional_nested_message();
ASSERT_EQ(sizeof(unittest::TestAllTypes::NestedMessage),
- message1.optional_nested_message().SpaceUsed());
+ message1.optional_nested_message().SpaceUsedLong());
EXPECT_EQ(previous_size +
sizeof(unittest::TestAllTypes::NestedMessage),
- message1.SpaceUsed());
+ message1.SpaceUsedLong());
}
TEST(GeneratedMessageTest, TestOneofSpaceUsed) {
unittest::TestOneof2 message1;
- EXPECT_LE(sizeof(unittest::TestOneof2), message1.SpaceUsed());
+ EXPECT_LE(sizeof(unittest::TestOneof2), message1.SpaceUsedLong());
- const int empty_message_size = message1.SpaceUsed();
+ const size_t empty_message_size = message1.SpaceUsedLong();
// Setting primitive types shouldn't affect the space used.
message1.set_foo_int(123);
message1.set_bar_int(12345);
- EXPECT_EQ(empty_message_size, message1.SpaceUsed());
+ EXPECT_EQ(empty_message_size, message1.SpaceUsedLong());
- // Setting a string in oneof to a small value should only increase SpaceUsed()
- // by the size of a string object.
+ // Setting a string in oneof to a small value should only increase
+ // SpaceUsedLong() by the size of a string object.
message1.set_foo_string("abc");
- EXPECT_LE(empty_message_size + sizeof(string), message1.SpaceUsed());
+ EXPECT_LE(empty_message_size + sizeof(string), message1.SpaceUsedLong());
// Setting a string in oneof to a value larger than the string object itself
- // should increase SpaceUsed(), because it cannot store the value internally.
+ // should increase SpaceUsedLong(), because it cannot store the value
+ // internally.
message1.set_foo_string(string(sizeof(string) + 1, 'x'));
int min_expected_increase = message1.foo_string().capacity() +
sizeof(string);
EXPECT_LE(empty_message_size + min_expected_increase,
- message1.SpaceUsed());
+ message1.SpaceUsedLong());
// Setting a message in oneof should delete the other fields and increase the
// size by the size of the nested message type. NestedMessage is simple enough
// that it is equal to sizeof(NestedMessage)
message1.mutable_foo_message();
ASSERT_EQ(sizeof(unittest::TestOneof2::NestedMessage),
- message1.foo_message().SpaceUsed());
+ message1.foo_message().SpaceUsedLong());
EXPECT_EQ(empty_message_size +
sizeof(unittest::TestOneof2::NestedMessage),
- message1.SpaceUsed());
+ message1.SpaceUsedLong());
}
#endif // !PROTOBUF_TEST_NO_DESCRIPTORS
diff --git a/src/google/protobuf/compiler/cpp/metadata_test.cc b/src/google/protobuf/compiler/cpp/metadata_test.cc
index d1bb3194..456784c6 100644
--- a/src/google/protobuf/compiler/cpp/metadata_test.cc
+++ b/src/google/protobuf/compiler/cpp/metadata_test.cc
@@ -72,9 +72,7 @@ class CppMetadataTest : public ::testing::Test {
TestTempDir();
const bool result =
- atu::CaptureMetadata(filename, cpp_out,
- /* meta_file_suffix */ "", &cli, file,
- /* outputs */ NULL);
+ atu::RunProtoCompiler(filename, cpp_out, &cli, file);
if (!result) {
return result;
diff --git a/src/google/protobuf/compiler/java/java_enum_field.cc b/src/google/protobuf/compiler/java/java_enum_field.cc
index 9f7bb349..642cdd36 100644
--- a/src/google/protobuf/compiler/java/java_enum_field.cc
+++ b/src/google/protobuf/compiler/java/java_enum_field.cc
@@ -80,7 +80,7 @@ void SetEnumVariables(const FieldDescriptor* descriptor,
// Use deprecated valueOf() method to be compatible with old generated code
// for v2.5.0/v2.6.1.
// TODO(xiaofeng): Use "forNumber" when we no longer support compatibility
- // with v2.5.0/v2.6.1.
+ // with v2.5.0/v2.6.1, and remove the @SuppressWarnings annotations.
(*variables)["for_number"] = "valueOf";
if (SupportFieldPresence(descriptor->file())) {
@@ -199,6 +199,7 @@ GenerateMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
+ " @SuppressWarnings(\"deprecation\")\n"
" $type$ result = $type$.$for_number$($name$_);\n"
" return result == null ? $unknown$ : result;\n"
"}\n");
@@ -237,6 +238,7 @@ GenerateBuilderMembers(io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
+ " @SuppressWarnings(\"deprecation\")\n"
" $type$ result = $type$.$for_number$($name$_);\n"
" return result == null ? $unknown$ : result;\n"
"}\n");
@@ -320,6 +322,7 @@ GenerateParsingCode(io::Printer* printer) const {
} else {
printer->Print(variables_,
"int rawValue = input.readEnum();\n"
+ " @SuppressWarnings(\"deprecation\")\n"
"$type$ value = $type$.$for_number$(rawValue);\n"
"if (value == null) {\n"
" unknownFields.mergeVarintField($number$, rawValue);\n"
@@ -412,6 +415,7 @@ GenerateMembers(io::Printer* printer) const {
printer->Print(variables_,
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" if ($has_oneof_case_message$) {\n"
+ " @SuppressWarnings(\"deprecation\")\n"
" $type$ result = $type$.$for_number$(\n"
" (java.lang.Integer) $oneof_name$_);\n"
" return result == null ? $unknown$ : result;\n"
@@ -456,6 +460,7 @@ GenerateBuilderMembers(io::Printer* printer) const {
printer->Print(variables_,
"$deprecation$public $type$ ${$get$capitalized_name$$}$() {\n"
" if ($has_oneof_case_message$) {\n"
+ " @SuppressWarnings(\"deprecation\")\n"
" $type$ result = $type$.$for_number$(\n"
" (java.lang.Integer) $oneof_name$_);\n"
" return result == null ? $unknown$ : result;\n"
@@ -517,6 +522,7 @@ GenerateParsingCode(io::Printer* printer) const {
} else {
printer->Print(variables_,
"int rawValue = input.readEnum();\n"
+ "@SuppressWarnings(\"deprecation\")\n"
"$type$ value = $type$.$for_number$(rawValue);\n"
"if (value == null) {\n"
" unknownFields.mergeVarintField($number$, rawValue);\n"
@@ -626,6 +632,7 @@ GenerateMembers(io::Printer* printer) const {
" new com.google.protobuf.Internal.ListAdapter.Converter<\n"
" java.lang.Integer, $type$>() {\n"
" public $type$ convert(java.lang.Integer from) {\n"
+ " @SuppressWarnings(\"deprecation\")\n"
" $type$ result = $type$.$for_number$(from);\n"
" return result == null ? $unknown$ : result;\n"
" }\n"
@@ -879,6 +886,7 @@ GenerateParsingCode(io::Printer* printer) const {
} else {
printer->Print(variables_,
"int rawValue = input.readEnum();\n"
+ "@SuppressWarnings(\"deprecation\")\n"
"$type$ value = $type$.$for_number$(rawValue);\n"
"if (value == null) {\n"
" unknownFields.mergeVarintField($number$, rawValue);\n"
diff --git a/src/google/protobuf/compiler/java/java_message.cc b/src/google/protobuf/compiler/java/java_message.cc
index 2486b739..eca7cf9a 100644
--- a/src/google/protobuf/compiler/java/java_message.cc
+++ b/src/google/protobuf/compiler/java/java_message.cc
@@ -437,11 +437,10 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) {
for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) {
const FieldDescriptor* field = descriptor_->oneof_decl(i)->field(j);
printer->Print(
- "$field_name$($field_number$),\n",
- "field_name",
- ToUpper(field->name()),
- "field_number",
- SimpleItoa(field->number()));
+ "$deprecation$$field_name$($field_number$),\n",
+ "deprecation", field->options().deprecated() ? "@java.lang.Deprecated " : "",
+ "field_name", ToUpper(field->name()),
+ "field_number", SimpleItoa(field->number()));
}
printer->Print(
"$cap_oneof_name$_NOT_SET(0);\n",
@@ -1259,19 +1258,9 @@ GenerateParsingConstructor(io::Printer* printer) {
printer->Indent();
printer->Print(
- "case 0:\n" // zero signals EOF / limit reached
- " done = true;\n"
- " break;\n"
- "default: {\n"
- " if (!parseUnknownField$suffix$(\n"
- " input, unknownFields, extensionRegistry, tag)) {\n"
- " done = true;\n" // it's an endgroup tag
- " }\n"
- " break;\n"
- "}\n",
- "suffix",
- descriptor_->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ? "Proto3"
- : "");
+ "case 0:\n" // zero signals EOF / limit reached
+ " done = true;\n"
+ " break;\n");
for (int i = 0; i < descriptor_->field_count(); i++) {
const FieldDescriptor* field = sorted_fields[i];
@@ -1309,6 +1298,18 @@ GenerateParsingConstructor(io::Printer* printer) {
}
}
+ printer->Print(
+ "default: {\n"
+ " if (!parseUnknownField$suffix$(\n"
+ " input, unknownFields, extensionRegistry, tag)) {\n"
+ " done = true;\n" // it's an endgroup tag
+ " }\n"
+ " break;\n"
+ "}\n",
+ "suffix",
+ descriptor_->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ? "Proto3"
+ : "");
+
printer->Outdent();
printer->Outdent();
printer->Print(
diff --git a/src/google/protobuf/compiler/java/java_message_lite.cc b/src/google/protobuf/compiler/java/java_message_lite.cc
index d828be43..108504c7 100644
--- a/src/google/protobuf/compiler/java/java_message_lite.cc
+++ b/src/google/protobuf/compiler/java/java_message_lite.cc
@@ -1005,37 +1005,6 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodMergeFromStream(
" done = true;\n"
" break;\n");
- if (descriptor_->extension_range_count() > 0) {
- if (descriptor_->options().message_set_wire_format()) {
- printer->Print(
- "default: {\n"
- " if (!parseUnknownFieldAsMessageSet(\n"
- " getDefaultInstanceForType(), input, extensionRegistry,\n"
- " tag)) {\n"
- " done = true;\n" // it's an endgroup tag
- " }\n"
- " break;\n"
- "}\n");
- } else {
- printer->Print(
- "default: {\n"
- " if (!parseUnknownField(getDefaultInstanceForType(),\n"
- " input, extensionRegistry, tag)) {\n"
- " done = true;\n" // it's an endgroup tag
- " }\n"
- " break;\n"
- "}\n");
- }
- } else {
- printer->Print(
- "default: {\n"
- " if (!parseUnknownField(tag, input)) {\n"
- " done = true;\n" // it's an endgroup tag
- " }\n"
- " break;\n"
- "}\n");
- }
-
google::protobuf::scoped_array<const FieldDescriptor* > sorted_fields(
SortFieldsByNumber(descriptor_));
for (int i = 0; i < descriptor_->field_count(); i++) {
@@ -1073,6 +1042,37 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodMergeFromStream(
}
}
+ if (descriptor_->extension_range_count() > 0) {
+ if (descriptor_->options().message_set_wire_format()) {
+ printer->Print(
+ "default: {\n"
+ " if (!parseUnknownFieldAsMessageSet(\n"
+ " getDefaultInstanceForType(), input, extensionRegistry,\n"
+ " tag)) {\n"
+ " done = true;\n" // it's an endgroup tag
+ " }\n"
+ " break;\n"
+ "}\n");
+ } else {
+ printer->Print(
+ "default: {\n"
+ " if (!parseUnknownField(getDefaultInstanceForType(),\n"
+ " input, extensionRegistry, tag)) {\n"
+ " done = true;\n" // it's an endgroup tag
+ " }\n"
+ " break;\n"
+ "}\n");
+ }
+ } else {
+ printer->Print(
+ "default: {\n"
+ " if (!parseUnknownField(tag, input)) {\n"
+ " done = true;\n" // it's an endgroup tag
+ " }\n"
+ " break;\n"
+ "}\n");
+ }
+
printer->Outdent();
printer->Outdent();
printer->Print(
diff --git a/src/google/protobuf/compiler/js/js_generator.cc b/src/google/protobuf/compiler/js/js_generator.cc
index 16fe19ad..fd2d3dfd 100755
--- a/src/google/protobuf/compiler/js/js_generator.cc
+++ b/src/google/protobuf/compiler/js/js_generator.cc
@@ -195,9 +195,9 @@ string ModuleAlias(const string& filename) {
// We'll worry about this problem if/when we actually see it. This name isn't
// exposed to users so we can change it later if we need to.
string basename = StripProto(filename);
- StripString(&basename, "-", '$');
- StripString(&basename, "/", '_');
- StripString(&basename, ".", '_');
+ ReplaceCharacters(&basename, "-", '$');
+ ReplaceCharacters(&basename, "/", '_');
+ ReplaceCharacters(&basename, ".", '_');
return basename + "_pb";
}
@@ -1028,7 +1028,7 @@ string JSFieldTypeAnnotation(const GeneratorOptions& options,
if (!IsPrimitive(jstype)) {
jstype = "!" + jstype;
}
- jstype = "Array.<" + jstype + ">";
+ jstype = "Array<" + jstype + ">";
}
}
@@ -1558,6 +1558,22 @@ bool GenerateJspbAllowedSet(const GeneratorOptions& options,
return true;
}
+// Embeds base64 encoded GeneratedCodeInfo proto in a comment at the end of
+// file.
+void EmbedCodeAnnotations(const GeneratedCodeInfo& annotations,
+ io::Printer* printer) {
+ // Serialize annotations proto into base64 string.
+ string meta_content;
+ annotations.SerializeToString(&meta_content);
+ string meta_64;
+ Base64Escape(meta_content, &meta_64);
+
+ // Print base64 encoded annotations at the end of output file in
+ // a comment.
+ printer->Print("\n// Below is base64 encoded GeneratedCodeInfo proto");
+ printer->Print("\n// $encoded_proto$\n", "encoded_proto", meta_64);
+}
+
} // anonymous namespace
void Generator::GenerateHeader(const GeneratorOptions& options,
@@ -2822,7 +2838,7 @@ void Generator::GenerateClassExtensionFieldInfo(const GeneratorOptions& options,
"so that it\n"
" * works in OPTIMIZED mode.\n"
" *\n"
- " * @type {!Object.<number, jspb.ExtensionFieldInfo>}\n"
+ " * @type {!Object<number, jspb.ExtensionFieldInfo>}\n"
" */\n"
"$class$.extensions = {};\n"
"\n",
@@ -2843,7 +2859,7 @@ void Generator::GenerateClassExtensionFieldInfo(const GeneratorOptions& options,
"so that it\n"
" * works in OPTIMIZED mode.\n"
" *\n"
- " * @type {!Object.<number, jspb.ExtensionFieldBinaryInfo>}\n"
+ " * @type {!Object<number, jspb.ExtensionFieldBinaryInfo>}\n"
" */\n"
"$class$.extensionsBinary = {};\n"
"\n",
@@ -3195,7 +3211,7 @@ void Generator::GenerateExtension(const GeneratorOptions& options,
"/**\n"
" * A tuple of {field number, class constructor} for the extension\n"
" * field named `$name$`.\n"
- " * @type {!jspb.ExtensionFieldInfo.<$extensionType$>}\n"
+ " * @type {!jspb.ExtensionFieldInfo<$extensionType$>}\n"
" */\n"
"$class$.$name$ = new jspb.ExtensionFieldInfo(\n",
"name", JSObjectFieldName(options, field),
@@ -3634,10 +3650,7 @@ bool Generator::GenerateAll(const std::vector<const FileDescriptor*>& files,
}
if (options.annotate_code) {
- const string meta_file = filename + ".meta";
- google::protobuf::scoped_ptr<io::ZeroCopyOutputStream> info_output(
- context->Open(meta_file));
- annotations.SerializeToZeroCopyStream(info_output.get());
+ EmbedCodeAnnotations(annotations, &printer);
}
}
}
diff --git a/src/google/protobuf/compiler/mock_code_generator.cc b/src/google/protobuf/compiler/mock_code_generator.cc
index bfcb83df..7719ec3d 100644
--- a/src/google/protobuf/compiler/mock_code_generator.cc
+++ b/src/google/protobuf/compiler/mock_code_generator.cc
@@ -70,7 +70,7 @@ namespace compiler {
// Returns the list of the names of files in all_files in the form of a
// comma-separated string.
-string CommaSeparatedList(const std::vector<const FileDescriptor*> all_files) {
+string CommaSeparatedList(const std::vector<const FileDescriptor*>& all_files) {
std::vector<string> names;
for (size_t i = 0; i < all_files.size(); i++) {
names.push_back(all_files[i]->name());
diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc
index 80c8c625..d13ad2b3 100644
--- a/src/google/protobuf/compiler/plugin.pb.cc
+++ b/src/google/protobuf/compiler/plugin.pb.cc
@@ -325,13 +325,6 @@ const Version& Version::default_instance() {
return *internal_default_instance();
}
-Version* Version::New(::google::protobuf::Arena* arena) const {
- Version* n = new Version;
- if (arena != NULL) {
- arena->Own(n);
- }
- return n;
-}
void Version::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.Version)
@@ -342,7 +335,7 @@ void Version::Clear() {
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 0x00000001u) {
GOOGLE_DCHECK(!suffix_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
- (*suffix_.UnsafeRawStringPointer())->clear();
+ suffix_.UnsafeMutablePointer()->clear();
}
if (cached_has_bits & 14u) {
::memset(&major_, 0, static_cast<size_t>(
@@ -723,13 +716,6 @@ const CodeGeneratorRequest& CodeGeneratorRequest::default_instance() {
return *internal_default_instance();
}
-CodeGeneratorRequest* CodeGeneratorRequest::New(::google::protobuf::Arena* arena) const {
- CodeGeneratorRequest* n = new CodeGeneratorRequest;
- if (arena != NULL) {
- arena->Own(n);
- }
- return n;
-}
void CodeGeneratorRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorRequest)
@@ -743,7 +729,7 @@ void CodeGeneratorRequest::Clear() {
if (cached_has_bits & 3u) {
if (cached_has_bits & 0x00000001u) {
GOOGLE_DCHECK(!parameter_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
- (*parameter_.UnsafeRawStringPointer())->clear();
+ parameter_.UnsafeMutablePointer()->clear();
}
if (cached_has_bits & 0x00000002u) {
GOOGLE_DCHECK(compiler_version_ != NULL);
@@ -813,7 +799,8 @@ bool CodeGeneratorRequest::MergePartialFromCodedStream(
case 15: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(122u /* 122 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_proto_file()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_proto_file()));
} else {
goto handle_unusual;
}
@@ -870,14 +857,16 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
// optional .google.protobuf.compiler.Version compiler_version = 3;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 3, *this->compiler_version_, output);
+ 3, *compiler_version_, output);
}
// repeated .google.protobuf.FileDescriptorProto proto_file = 15;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->proto_file_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 15, this->proto_file(static_cast<int>(i)), output);
+ 15,
+ this->proto_file(static_cast<int>(i)),
+ output);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -920,7 +909,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 3, *this->compiler_version_, deterministic, target);
+ 3, *compiler_version_, deterministic, target);
}
// repeated .google.protobuf.FileDescriptorProto proto_file = 15;
@@ -979,7 +968,7 @@ size_t CodeGeneratorRequest::ByteSizeLong() const {
if (has_compiler_version()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->compiler_version_);
+ *compiler_version_);
}
}
@@ -1051,8 +1040,8 @@ void CodeGeneratorRequest::Swap(CodeGeneratorRequest* other) {
}
void CodeGeneratorRequest::InternalSwap(CodeGeneratorRequest* other) {
using std::swap;
- file_to_generate_.InternalSwap(&other->file_to_generate_);
- proto_file_.InternalSwap(&other->proto_file_);
+ file_to_generate_.InternalSwap(CastToBase(&other->file_to_generate_));
+ CastToBase(&proto_file_)->InternalSwap(CastToBase(&other->proto_file_));
parameter_.Swap(&other->parameter_);
swap(compiler_version_, other->compiler_version_);
swap(_has_bits_[0], other->_has_bits_[0]);
@@ -1138,13 +1127,6 @@ const CodeGeneratorResponse_File& CodeGeneratorResponse_File::default_instance()
return *internal_default_instance();
}
-CodeGeneratorResponse_File* CodeGeneratorResponse_File::New(::google::protobuf::Arena* arena) const {
- CodeGeneratorResponse_File* n = new CodeGeneratorResponse_File;
- if (arena != NULL) {
- arena->Own(n);
- }
- return n;
-}
void CodeGeneratorResponse_File::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse.File)
@@ -1156,15 +1138,15 @@ void CodeGeneratorResponse_File::Clear() {
if (cached_has_bits & 7u) {
if (cached_has_bits & 0x00000001u) {
GOOGLE_DCHECK(!name_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
- (*name_.UnsafeRawStringPointer())->clear();
+ name_.UnsafeMutablePointer()->clear();
}
if (cached_has_bits & 0x00000002u) {
GOOGLE_DCHECK(!insertion_point_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
- (*insertion_point_.UnsafeRawStringPointer())->clear();
+ insertion_point_.UnsafeMutablePointer()->clear();
}
if (cached_has_bits & 0x00000004u) {
GOOGLE_DCHECK(!content_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
- (*content_.UnsafeRawStringPointer())->clear();
+ content_.UnsafeMutablePointer()->clear();
}
}
_has_bits_.Clear();
@@ -1518,13 +1500,6 @@ const CodeGeneratorResponse& CodeGeneratorResponse::default_instance() {
return *internal_default_instance();
}
-CodeGeneratorResponse* CodeGeneratorResponse::New(::google::protobuf::Arena* arena) const {
- CodeGeneratorResponse* n = new CodeGeneratorResponse;
- if (arena != NULL) {
- arena->Own(n);
- }
- return n;
-}
void CodeGeneratorResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse)
@@ -1536,7 +1511,7 @@ void CodeGeneratorResponse::Clear() {
cached_has_bits = _has_bits_[0];
if (cached_has_bits & 0x00000001u) {
GOOGLE_DCHECK(!error_.IsDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()));
- (*error_.UnsafeRawStringPointer())->clear();
+ error_.UnsafeMutablePointer()->clear();
}
_has_bits_.Clear();
_internal_metadata_.Clear();
@@ -1572,7 +1547,8 @@ bool CodeGeneratorResponse::MergePartialFromCodedStream(
case 15: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(122u /* 122 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_file()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_file()));
} else {
goto handle_unusual;
}
@@ -1620,7 +1596,9 @@ void CodeGeneratorResponse::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->file_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 15, this->file(static_cast<int>(i)), output);
+ 15,
+ this->file(static_cast<int>(i)),
+ output);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -1752,7 +1730,7 @@ void CodeGeneratorResponse::Swap(CodeGeneratorResponse* other) {
}
void CodeGeneratorResponse::InternalSwap(CodeGeneratorResponse* other) {
using std::swap;
- file_.InternalSwap(&other->file_);
+ CastToBase(&file_)->InternalSwap(CastToBase(&other->file_));
error_.Swap(&other->error_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
@@ -1769,5 +1747,21 @@ void CodeGeneratorResponse::InternalSwap(CodeGeneratorResponse* other) {
} // namespace compiler
} // namespace protobuf
} // namespace google
+namespace google {
+namespace protobuf {
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::compiler::Version* Arena::Create< ::google::protobuf::compiler::Version >(Arena* arena) {
+ return Arena::CreateInternal< ::google::protobuf::compiler::Version >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::compiler::CodeGeneratorRequest* Arena::Create< ::google::protobuf::compiler::CodeGeneratorRequest >(Arena* arena) {
+ return Arena::CreateInternal< ::google::protobuf::compiler::CodeGeneratorRequest >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::compiler::CodeGeneratorResponse_File* Arena::Create< ::google::protobuf::compiler::CodeGeneratorResponse_File >(Arena* arena) {
+ return Arena::CreateInternal< ::google::protobuf::compiler::CodeGeneratorResponse_File >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::compiler::CodeGeneratorResponse* Arena::Create< ::google::protobuf::compiler::CodeGeneratorResponse >(Arena* arena) {
+ return Arena::CreateInternal< ::google::protobuf::compiler::CodeGeneratorResponse >(arena);
+}
+} // namespace protobuf
+} // namespace google
// @@protoc_insertion_point(global_scope)
diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h
index ef1cfb93..a6c1300e 100644
--- a/src/google/protobuf/compiler/plugin.pb.h
+++ b/src/google/protobuf/compiler/plugin.pb.h
@@ -1,8 +1,8 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/compiler/plugin.proto
-#ifndef PROTOBUF_google_2fprotobuf_2fcompiler_2fplugin_2eproto__INCLUDED
-#define PROTOBUF_google_2fprotobuf_2fcompiler_2fplugin_2eproto__INCLUDED
+#ifndef PROTOBUF_google_2fprotobuf_2fcompiler_2fplugin_2eproto_INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fcompiler_2fplugin_2eproto_INCLUDED
#include <string>
@@ -84,6 +84,14 @@ LIBPROTOC_EXPORT extern VersionDefaultTypeInternal _Version_default_instance_;
} // namespace google
namespace google {
namespace protobuf {
+template<> LIBPROTOC_EXPORT ::google::protobuf::compiler::CodeGeneratorRequest* Arena::Create< ::google::protobuf::compiler::CodeGeneratorRequest>(Arena*);
+template<> LIBPROTOC_EXPORT ::google::protobuf::compiler::CodeGeneratorResponse* Arena::Create< ::google::protobuf::compiler::CodeGeneratorResponse>(Arena*);
+template<> LIBPROTOC_EXPORT ::google::protobuf::compiler::CodeGeneratorResponse_File* Arena::Create< ::google::protobuf::compiler::CodeGeneratorResponse_File>(Arena*);
+template<> LIBPROTOC_EXPORT ::google::protobuf::compiler::Version* Arena::Create< ::google::protobuf::compiler::Version>(Arena*);
+} // namespace protobuf
+} // namespace google
+namespace google {
+namespace protobuf {
namespace compiler {
// ===================================================================
@@ -139,9 +147,13 @@ class LIBPROTOC_EXPORT Version : public ::google::protobuf::Message /* @@protoc_
// implements Message ----------------------------------------------
- inline Version* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Version* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<Version>(NULL);
+ }
- Version* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Version* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<Version>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Version& from);
@@ -287,9 +299,13 @@ class LIBPROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message
// implements Message ----------------------------------------------
- inline CodeGeneratorRequest* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline CodeGeneratorRequest* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<CodeGeneratorRequest>(NULL);
+ }
- CodeGeneratorRequest* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ CodeGeneratorRequest* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<CodeGeneratorRequest>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const CodeGeneratorRequest& from);
@@ -351,11 +367,11 @@ class LIBPROTOC_EXPORT CodeGeneratorRequest : public ::google::protobuf::Message
int proto_file_size() const;
void clear_proto_file();
static const int kProtoFileFieldNumber = 15;
- const ::google::protobuf::FileDescriptorProto& proto_file(int index) const;
::google::protobuf::FileDescriptorProto* mutable_proto_file(int index);
- ::google::protobuf::FileDescriptorProto* add_proto_file();
::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >*
mutable_proto_file();
+ const ::google::protobuf::FileDescriptorProto& proto_file(int index) const;
+ ::google::protobuf::FileDescriptorProto* add_proto_file();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >&
proto_file() const;
@@ -453,9 +469,13 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse_File : public ::google::protobuf::M
// implements Message ----------------------------------------------
- inline CodeGeneratorResponse_File* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline CodeGeneratorResponse_File* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<CodeGeneratorResponse_File>(NULL);
+ }
- CodeGeneratorResponse_File* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ CodeGeneratorResponse_File* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<CodeGeneratorResponse_File>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const CodeGeneratorResponse_File& from);
@@ -607,9 +627,13 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse : public ::google::protobuf::Messag
// implements Message ----------------------------------------------
- inline CodeGeneratorResponse* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline CodeGeneratorResponse* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<CodeGeneratorResponse>(NULL);
+ }
- CodeGeneratorResponse* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ CodeGeneratorResponse* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<CodeGeneratorResponse>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const CodeGeneratorResponse& from);
@@ -651,11 +675,11 @@ class LIBPROTOC_EXPORT CodeGeneratorResponse : public ::google::protobuf::Messag
int file_size() const;
void clear_file();
static const int kFileFieldNumber = 15;
- const ::google::protobuf::compiler::CodeGeneratorResponse_File& file(int index) const;
::google::protobuf::compiler::CodeGeneratorResponse_File* mutable_file(int index);
- ::google::protobuf::compiler::CodeGeneratorResponse_File* add_file();
::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >*
mutable_file();
+ const ::google::protobuf::compiler::CodeGeneratorResponse_File& file(int index) const;
+ ::google::protobuf::compiler::CodeGeneratorResponse_File* add_file();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >&
file() const;
@@ -973,23 +997,23 @@ inline void CodeGeneratorRequest::set_allocated_parameter(::std::string* paramet
inline int CodeGeneratorRequest::proto_file_size() const {
return proto_file_.size();
}
-inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
- return proto_file_.Get(index);
-}
inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::mutable_proto_file(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
return proto_file_.Mutable(index);
}
-inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() {
- // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
- return proto_file_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >*
CodeGeneratorRequest::mutable_proto_file() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
return &proto_file_;
}
+inline const ::google::protobuf::FileDescriptorProto& CodeGeneratorRequest::proto_file(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
+ return proto_file_.Get(index);
+}
+inline ::google::protobuf::FileDescriptorProto* CodeGeneratorRequest::add_proto_file() {
+ // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
+ return proto_file_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >&
CodeGeneratorRequest::proto_file() const {
// @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorRequest.proto_file)
@@ -1026,7 +1050,8 @@ inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::release_comp
inline ::google::protobuf::compiler::Version* CodeGeneratorRequest::mutable_compiler_version() {
set_has_compiler_version();
if (compiler_version_ == NULL) {
- compiler_version_ = new ::google::protobuf::compiler::Version;
+ compiler_version_ = ::google::protobuf::Arena::Create< ::google::protobuf::compiler::Version >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.compiler_version)
return compiler_version_;
@@ -1317,23 +1342,23 @@ inline int CodeGeneratorResponse::file_size() const {
inline void CodeGeneratorResponse::clear_file() {
file_.Clear();
}
-inline const ::google::protobuf::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.file)
- return file_.Get(index);
-}
inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::mutable_file(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorResponse.file)
return file_.Mutable(index);
}
-inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() {
- // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorResponse.file)
- return file_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >*
CodeGeneratorResponse::mutable_file() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.compiler.CodeGeneratorResponse.file)
return &file_;
}
+inline const ::google::protobuf::compiler::CodeGeneratorResponse_File& CodeGeneratorResponse::file(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.file)
+ return file_.Get(index);
+}
+inline ::google::protobuf::compiler::CodeGeneratorResponse_File* CodeGeneratorResponse::add_file() {
+ // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorResponse.file)
+ return file_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::compiler::CodeGeneratorResponse_File >&
CodeGeneratorResponse::file() const {
// @@protoc_insertion_point(field_list:google.protobuf.compiler.CodeGeneratorResponse.file)
@@ -1358,4 +1383,4 @@ CodeGeneratorResponse::file() const {
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_google_2fprotobuf_2fcompiler_2fplugin_2eproto__INCLUDED
+#endif // PROTOBUF_google_2fprotobuf_2fcompiler_2fplugin_2eproto_INCLUDED
diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc
index 3f54b848..9d48bfba 100644
--- a/src/google/protobuf/descriptor.cc
+++ b/src/google/protobuf/descriptor.cc
@@ -32,7 +32,10 @@
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
+#include <algorithm>
+#include <functional>
#include <google/protobuf/stubs/hash.h>
+#include <limits>
#include <map>
#include <memory>
#ifndef _SHARED_PTR_H
@@ -41,8 +44,6 @@
#include <set>
#include <string>
#include <vector>
-#include <algorithm>
-#include <limits>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
@@ -375,15 +376,13 @@ class PrefixRemover {
string prefix_;
};
-// A DescriptorPool contains a bunch of hash_maps to implement the
+// A DescriptorPool contains a bunch of hash-maps to implement the
// various Find*By*() methods. Since hashtable lookups are O(1), it's
-// most efficient to construct a fixed set of large hash_maps used by
+// most efficient to construct a fixed set of large hash-maps used by
// all objects in the pool rather than construct one or more small
-// hash_maps for each object.
+// hash-maps for each object.
//
-// The keys to these hash_maps are (parent, name) or (parent, number)
-// pairs. Unfortunately STL doesn't provide hash functions for pair<>,
-// so we must invent our own.
+// The keys to these hash-maps are (parent, name) or (parent, number) pairs.
//
// TODO(kenton): Use StringPiece rather than const char* in keys? It would
// be a lot cleaner but we'd just have to convert it back to const char*
@@ -398,6 +397,13 @@ struct PointerStringPairEqual {
}
};
+typedef std::pair<const Descriptor*, int> DescriptorIntPair;
+typedef std::pair<const EnumDescriptor*, int> EnumIntPair;
+
+#define HASH_MAP hash_map
+#define HASH_SET hash_set
+#define HASH_FXN hash
+
template<typename PairType>
struct PointerIntegerPairHash {
size_t operator()(const PairType& p) const {
@@ -417,9 +423,6 @@ struct PointerIntegerPairHash {
}
};
-typedef std::pair<const Descriptor*, int> DescriptorIntPair;
-typedef std::pair<const EnumDescriptor*, int> EnumIntPair;
-
struct PointerStringPairHash {
size_t operator()(const PointerStringPair& p) const {
// FIXME(kenton): What is the best way to compute this hash? I have
@@ -445,31 +448,37 @@ struct PointerStringPairHash {
const Symbol kNullSymbol;
-typedef hash_map<const char*, Symbol,
- hash<const char*>, streq>
- SymbolsByNameMap;
-typedef hash_map<PointerStringPair, Symbol,
- PointerStringPairHash, PointerStringPairEqual>
- SymbolsByParentMap;
-typedef hash_map<const char*, const FileDescriptor*,
- hash<const char*>, streq>
- FilesByNameMap;
-typedef hash_map<PointerStringPair, const FieldDescriptor*,
+typedef HASH_MAP<const char*, Symbol, HASH_FXN<const char*>, streq>
+ SymbolsByNameMap;
+
+typedef HASH_MAP<PointerStringPair, Symbol, PointerStringPairHash,
+ PointerStringPairEqual>
+ SymbolsByParentMap;
+
+typedef HASH_MAP<const char*, const FileDescriptor*, HASH_FXN<const char*>,
+ streq>
+ FilesByNameMap;
+
+typedef HASH_MAP<PointerStringPair, const FieldDescriptor*,
PointerStringPairHash, PointerStringPairEqual>
- FieldsByNameMap;
-typedef hash_map<DescriptorIntPair, const FieldDescriptor*,
- PointerIntegerPairHash<DescriptorIntPair> >
- FieldsByNumberMap;
-typedef hash_map<EnumIntPair, const EnumValueDescriptor*,
- PointerIntegerPairHash<EnumIntPair> >
- EnumValuesByNumberMap;
-// This is a map rather than a hash_map, since we use it to iterate
+ FieldsByNameMap;
+
+typedef HASH_MAP<DescriptorIntPair, const FieldDescriptor*,
+ PointerIntegerPairHash<DescriptorIntPair>,
+ std::equal_to<DescriptorIntPair> >
+ FieldsByNumberMap;
+
+typedef HASH_MAP<EnumIntPair, const EnumValueDescriptor*,
+ PointerIntegerPairHash<EnumIntPair>,
+ std::equal_to<EnumIntPair> >
+ EnumValuesByNumberMap;
+// This is a map rather than a hash-map, since we use it to iterate
// through all the extensions that extend a given Descriptor, and an
// ordered data structure that implements lower_bound is convenient
// for that.
typedef std::map<DescriptorIntPair, const FieldDescriptor*>
ExtensionsGroupedByDescriptorMap;
-typedef hash_map<string, const SourceCodeInfo_Location*> LocationsByPathMap;
+typedef HASH_MAP<string, const SourceCodeInfo_Location*> LocationsByPathMap;
std::set<string>* allowed_proto3_extendees_ = NULL;
GOOGLE_PROTOBUF_DECLARE_ONCE(allowed_proto3_extendees_init_);
@@ -564,17 +573,17 @@ class DescriptorPool::Tables {
// execution of the current public API call, but for compatibility with
// legacy clients, this is cleared at the beginning of each public API call.
// Not used when fallback_database_ == NULL.
- hash_set<string> known_bad_files_;
+ HASH_SET<string> known_bad_files_;
// A set of symbols which we have tried to load from the fallback database
// and encountered errors. We will not attempt to load them again during
// execution of the current public API call, but for compatibility with
// legacy clients, this is cleared at the beginning of each public API call.
- hash_set<string> known_bad_symbols_;
+ HASH_SET<string> known_bad_symbols_;
// The set of descriptors for which we've already loaded the full
// set of extensions numbers from fallback_database_.
- hash_set<const Descriptor*> extensions_loaded_from_db_;
+ HASH_SET<const Descriptor*> extensions_loaded_from_db_;
// -----------------------------------------------------------------
// Finding items.
@@ -787,14 +796,13 @@ class FileDescriptorTables {
};
DescriptorPool::Tables::Tables()
- // Start some hash_map and hash_set objects with a small # of buckets
+ // Start some hash-map and hash-set objects with a small # of buckets
: known_bad_files_(3),
known_bad_symbols_(3),
extensions_loaded_from_db_(3),
symbols_by_name_(3),
files_by_name_(3) {}
-
DescriptorPool::Tables::~Tables() {
GOOGLE_DCHECK(checkpoints_.empty());
// Note that the deletion order is important, since the destructors of some
@@ -948,8 +956,10 @@ inline Symbol FileDescriptorTables::FindNestedSymbolOfType(
Symbol DescriptorPool::Tables::FindByNameHelper(
const DescriptorPool* pool, const string& name) {
MutexLockMaybe lock(pool->mutex_);
- known_bad_symbols_.clear();
- known_bad_files_.clear();
+ if (pool->fallback_database_ != NULL) {
+ known_bad_symbols_.clear();
+ known_bad_files_.clear();
+ }
Symbol result = FindSymbol(name);
if (result.IsNull() && pool->underlay_ != NULL) {
@@ -1403,8 +1413,10 @@ void DescriptorPool::InternalAddGeneratedFile(
const FileDescriptor* DescriptorPool::FindFileByName(const string& name) const {
MutexLockMaybe lock(mutex_);
- tables_->known_bad_symbols_.clear();
- tables_->known_bad_files_.clear();
+ if (fallback_database_ != NULL) {
+ tables_->known_bad_symbols_.clear();
+ tables_->known_bad_files_.clear();
+ }
const FileDescriptor* result = tables_->FindFile(name);
if (result != NULL) return result;
if (underlay_ != NULL) {
@@ -1421,8 +1433,10 @@ const FileDescriptor* DescriptorPool::FindFileByName(const string& name) const {
const FileDescriptor* DescriptorPool::FindFileContainingSymbol(
const string& symbol_name) const {
MutexLockMaybe lock(mutex_);
- tables_->known_bad_symbols_.clear();
- tables_->known_bad_files_.clear();
+ if (fallback_database_ != NULL) {
+ tables_->known_bad_symbols_.clear();
+ tables_->known_bad_files_.clear();
+ }
Symbol result = tables_->FindSymbol(symbol_name);
if (!result.IsNull()) return result.GetFile();
if (underlay_ != NULL) {
@@ -1508,8 +1522,10 @@ const FieldDescriptor* DescriptorPool::FindExtensionByNumber(
}
}
MutexLockMaybe lock(mutex_);
- tables_->known_bad_symbols_.clear();
- tables_->known_bad_files_.clear();
+ if (fallback_database_ != NULL) {
+ tables_->known_bad_symbols_.clear();
+ tables_->known_bad_files_.clear();
+ }
const FieldDescriptor* result = tables_->FindExtension(extendee, number);
if (result != NULL) {
return result;
@@ -1531,8 +1547,10 @@ void DescriptorPool::FindAllExtensions(
const Descriptor* extendee,
std::vector<const FieldDescriptor*>* out) const {
MutexLockMaybe lock(mutex_);
- tables_->known_bad_symbols_.clear();
- tables_->known_bad_files_.clear();
+ if (fallback_database_ != NULL) {
+ tables_->known_bad_symbols_.clear();
+ tables_->known_bad_files_.clear();
+ }
// Initialize tables_->extensions_ from the fallback database first
// (but do this only once per descriptor).
@@ -4539,7 +4557,7 @@ void DescriptorBuilder::BuildMessage(const DescriptorProto& proto,
}
}
- hash_set<string> reserved_name_set;
+ HASH_SET<string> reserved_name_set;
for (int i = 0; i < proto.reserved_name_size(); i++) {
const string& name = proto.reserved_name(i);
if (reserved_name_set.find(name) == reserved_name_set.end()) {
@@ -5125,7 +5143,7 @@ void DescriptorBuilder::BuildEnum(const EnumDescriptorProto& proto,
}
}
- hash_set<string> reserved_name_set;
+ HASH_SET<string> reserved_name_set;
for (int i = 0; i < proto.reserved_name_size(); i++) {
const string& name = proto.reserved_name(i);
if (reserved_name_set.find(name) == reserved_name_set.end()) {
diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc
index ab1b4992..c8362376 100644
--- a/src/google/protobuf/descriptor.pb.cc
+++ b/src/google/protobuf/descriptor.pb.cc
@@ -1635,9 +1635,6 @@ const FileDescriptorSet& FileDescriptorSet::default_instance() {
return *internal_default_instance();
}
-FileDescriptorSet* FileDescriptorSet::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<FileDescriptorSet>(arena);
-}
void FileDescriptorSet::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorSet)
@@ -1664,7 +1661,8 @@ bool FileDescriptorSet::MergePartialFromCodedStream(
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_file()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_file()));
} else {
goto handle_unusual;
}
@@ -1701,7 +1699,9 @@ void FileDescriptorSet::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->file_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 1, this->file(static_cast<int>(i)), output);
+ 1,
+ this->file(static_cast<int>(i)),
+ output);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -1826,7 +1826,7 @@ void FileDescriptorSet::UnsafeArenaSwap(FileDescriptorSet* other) {
}
void FileDescriptorSet::InternalSwap(FileDescriptorSet* other) {
using std::swap;
- file_.InternalSwap(&other->file_);
+ CastToBase(&file_)->InternalSwap(CastToBase(&other->file_));
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
@@ -1846,10 +1846,6 @@ void FileDescriptorProto::InitAsDefaultInstance() {
::google::protobuf::_FileDescriptorProto_default_instance_._instance.get_mutable()->source_code_info_ = const_cast< ::google::protobuf::SourceCodeInfo*>(
::google::protobuf::SourceCodeInfo::internal_default_instance());
}
-void FileDescriptorProto::_slow_mutable_options() {
- options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::FileOptions >(
- GetArenaNoVirtual());
-}
void FileDescriptorProto::unsafe_arena_set_allocated_options(
::google::protobuf::FileOptions* options) {
if (GetArenaNoVirtual() == NULL) {
@@ -1863,10 +1859,6 @@ void FileDescriptorProto::unsafe_arena_set_allocated_options(
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.options)
}
-void FileDescriptorProto::_slow_mutable_source_code_info() {
- source_code_info_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::SourceCodeInfo >(
- GetArenaNoVirtual());
-}
void FileDescriptorProto::unsafe_arena_set_allocated_source_code_info(
::google::protobuf::SourceCodeInfo* source_code_info) {
if (GetArenaNoVirtual() == NULL) {
@@ -2004,9 +1996,6 @@ const FileDescriptorProto& FileDescriptorProto::default_instance() {
return *internal_default_instance();
}
-FileDescriptorProto* FileDescriptorProto::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<FileDescriptorProto>(arena);
-}
void FileDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorProto)
@@ -2111,7 +2100,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream(
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_message_type()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_message_type()));
} else {
goto handle_unusual;
}
@@ -2122,7 +2112,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream(
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_enum_type()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_enum_type()));
} else {
goto handle_unusual;
}
@@ -2133,7 +2124,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream(
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_service()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_service()));
} else {
goto handle_unusual;
}
@@ -2144,7 +2136,8 @@ bool FileDescriptorProto::MergePartialFromCodedStream(
case 7: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u /* 58 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_extension()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_extension()));
} else {
goto handle_unusual;
}
@@ -2290,40 +2283,48 @@ void FileDescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->message_type_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 4, this->message_type(static_cast<int>(i)), output);
+ 4,
+ this->message_type(static_cast<int>(i)),
+ output);
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->enum_type_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 5, this->enum_type(static_cast<int>(i)), output);
+ 5,
+ this->enum_type(static_cast<int>(i)),
+ output);
}
// repeated .google.protobuf.ServiceDescriptorProto service = 6;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->service_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 6, this->service(static_cast<int>(i)), output);
+ 6,
+ this->service(static_cast<int>(i)),
+ output);
}
// repeated .google.protobuf.FieldDescriptorProto extension = 7;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->extension_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 7, this->extension(static_cast<int>(i)), output);
+ 7,
+ this->extension(static_cast<int>(i)),
+ output);
}
// optional .google.protobuf.FileOptions options = 8;
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 8, *this->options_, output);
+ 8, *options_, output);
}
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
if (cached_has_bits & 0x00000010u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 9, *this->source_code_info_, output);
+ 9, *source_code_info_, output);
}
// repeated int32 public_dependency = 10;
@@ -2431,14 +2432,14 @@ void FileDescriptorProto::SerializeWithCachedSizes(
if (cached_has_bits & 0x00000008u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 8, *this->options_, deterministic, target);
+ 8, *options_, deterministic, target);
}
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
if (cached_has_bits & 0x00000010u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 9, *this->source_code_info_, deterministic, target);
+ 9, *source_code_info_, deterministic, target);
}
// repeated int32 public_dependency = 10;
@@ -2573,14 +2574,14 @@ size_t FileDescriptorProto::ByteSizeLong() const {
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->options_);
+ *options_);
}
// optional .google.protobuf.SourceCodeInfo source_code_info = 9;
if (has_source_code_info()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->source_code_info_);
+ *source_code_info_);
}
}
@@ -2686,11 +2687,11 @@ void FileDescriptorProto::UnsafeArenaSwap(FileDescriptorProto* other) {
}
void FileDescriptorProto::InternalSwap(FileDescriptorProto* other) {
using std::swap;
- dependency_.InternalSwap(&other->dependency_);
- message_type_.InternalSwap(&other->message_type_);
- enum_type_.InternalSwap(&other->enum_type_);
- service_.InternalSwap(&other->service_);
- extension_.InternalSwap(&other->extension_);
+ dependency_.InternalSwap(CastToBase(&other->dependency_));
+ CastToBase(&message_type_)->InternalSwap(CastToBase(&other->message_type_));
+ CastToBase(&enum_type_)->InternalSwap(CastToBase(&other->enum_type_));
+ CastToBase(&service_)->InternalSwap(CastToBase(&other->service_));
+ CastToBase(&extension_)->InternalSwap(CastToBase(&other->extension_));
public_dependency_.InternalSwap(&other->public_dependency_);
weak_dependency_.InternalSwap(&other->weak_dependency_);
name_.Swap(&other->name_);
@@ -2715,10 +2716,6 @@ void DescriptorProto_ExtensionRange::InitAsDefaultInstance() {
::google::protobuf::_DescriptorProto_ExtensionRange_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::ExtensionRangeOptions*>(
::google::protobuf::ExtensionRangeOptions::internal_default_instance());
}
-void DescriptorProto_ExtensionRange::_slow_mutable_options() {
- options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ExtensionRangeOptions >(
- GetArenaNoVirtual());
-}
void DescriptorProto_ExtensionRange::unsafe_arena_set_allocated_options(
::google::protobuf::ExtensionRangeOptions* options) {
if (GetArenaNoVirtual() == NULL) {
@@ -2809,9 +2806,6 @@ const DescriptorProto_ExtensionRange& DescriptorProto_ExtensionRange::default_in
return *internal_default_instance();
}
-DescriptorProto_ExtensionRange* DescriptorProto_ExtensionRange::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<DescriptorProto_ExtensionRange>(arena);
-}
void DescriptorProto_ExtensionRange::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ExtensionRange)
@@ -2923,7 +2917,7 @@ void DescriptorProto_ExtensionRange::SerializeWithCachedSizes(
// optional .google.protobuf.ExtensionRangeOptions options = 3;
if (cached_has_bits & 0x00000001u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 3, *this->options_, output);
+ 3, *options_, output);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -2955,7 +2949,7 @@ void DescriptorProto_ExtensionRange::SerializeWithCachedSizes(
if (cached_has_bits & 0x00000001u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 3, *this->options_, deterministic, target);
+ 3, *options_, deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -2980,7 +2974,7 @@ size_t DescriptorProto_ExtensionRange::ByteSizeLong() const {
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->options_);
+ *options_);
}
// optional int32 start = 1;
@@ -3172,9 +3166,6 @@ const DescriptorProto_ReservedRange& DescriptorProto_ReservedRange::default_inst
return *internal_default_instance();
}
-DescriptorProto_ReservedRange* DescriptorProto_ReservedRange::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<DescriptorProto_ReservedRange>(arena);
-}
void DescriptorProto_ReservedRange::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ReservedRange)
@@ -3424,10 +3415,6 @@ void DescriptorProto::InitAsDefaultInstance() {
::google::protobuf::_DescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::MessageOptions*>(
::google::protobuf::MessageOptions::internal_default_instance());
}
-void DescriptorProto::_slow_mutable_options() {
- options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::MessageOptions >(
- GetArenaNoVirtual());
-}
void DescriptorProto::unsafe_arena_set_allocated_options(
::google::protobuf::MessageOptions* options) {
if (GetArenaNoVirtual() == NULL) {
@@ -3543,9 +3530,6 @@ const DescriptorProto& DescriptorProto::default_instance() {
return *internal_default_instance();
}
-DescriptorProto* DescriptorProto::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<DescriptorProto>(arena);
-}
void DescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto)
@@ -3606,7 +3590,8 @@ bool DescriptorProto::MergePartialFromCodedStream(
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_field()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_field()));
} else {
goto handle_unusual;
}
@@ -3617,7 +3602,8 @@ bool DescriptorProto::MergePartialFromCodedStream(
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_nested_type()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_nested_type()));
} else {
goto handle_unusual;
}
@@ -3628,7 +3614,8 @@ bool DescriptorProto::MergePartialFromCodedStream(
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_enum_type()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_enum_type()));
} else {
goto handle_unusual;
}
@@ -3639,7 +3626,8 @@ bool DescriptorProto::MergePartialFromCodedStream(
case 5: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_extension_range()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_extension_range()));
} else {
goto handle_unusual;
}
@@ -3650,7 +3638,8 @@ bool DescriptorProto::MergePartialFromCodedStream(
case 6: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_extension()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_extension()));
} else {
goto handle_unusual;
}
@@ -3673,7 +3662,8 @@ bool DescriptorProto::MergePartialFromCodedStream(
case 8: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(66u /* 66 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_oneof_decl()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_oneof_decl()));
} else {
goto handle_unusual;
}
@@ -3684,7 +3674,8 @@ bool DescriptorProto::MergePartialFromCodedStream(
case 9: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(74u /* 74 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_reserved_range()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_reserved_range()));
} else {
goto handle_unusual;
}
@@ -3749,55 +3740,69 @@ void DescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->field_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 2, this->field(static_cast<int>(i)), output);
+ 2,
+ this->field(static_cast<int>(i)),
+ output);
}
// repeated .google.protobuf.DescriptorProto nested_type = 3;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->nested_type_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 3, this->nested_type(static_cast<int>(i)), output);
+ 3,
+ this->nested_type(static_cast<int>(i)),
+ output);
}
// repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->enum_type_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 4, this->enum_type(static_cast<int>(i)), output);
+ 4,
+ this->enum_type(static_cast<int>(i)),
+ output);
}
// repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->extension_range_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 5, this->extension_range(static_cast<int>(i)), output);
+ 5,
+ this->extension_range(static_cast<int>(i)),
+ output);
}
// repeated .google.protobuf.FieldDescriptorProto extension = 6;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->extension_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 6, this->extension(static_cast<int>(i)), output);
+ 6,
+ this->extension(static_cast<int>(i)),
+ output);
}
// optional .google.protobuf.MessageOptions options = 7;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 7, *this->options_, output);
+ 7, *options_, output);
}
// repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->oneof_decl_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 8, this->oneof_decl(static_cast<int>(i)), output);
+ 8,
+ this->oneof_decl(static_cast<int>(i)),
+ output);
}
// repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->reserved_range_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 9, this->reserved_range(static_cast<int>(i)), output);
+ 9,
+ this->reserved_range(static_cast<int>(i)),
+ output);
}
// repeated string reserved_name = 10;
@@ -3880,7 +3885,7 @@ void DescriptorProto::SerializeWithCachedSizes(
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 7, *this->options_, deterministic, target);
+ 7, *options_, deterministic, target);
}
// repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
@@ -4023,7 +4028,7 @@ size_t DescriptorProto::ByteSizeLong() const {
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->options_);
+ *options_);
}
}
@@ -4123,14 +4128,14 @@ void DescriptorProto::UnsafeArenaSwap(DescriptorProto* other) {
}
void DescriptorProto::InternalSwap(DescriptorProto* other) {
using std::swap;
- field_.InternalSwap(&other->field_);
- nested_type_.InternalSwap(&other->nested_type_);
- enum_type_.InternalSwap(&other->enum_type_);
- extension_range_.InternalSwap(&other->extension_range_);
- extension_.InternalSwap(&other->extension_);
- oneof_decl_.InternalSwap(&other->oneof_decl_);
- reserved_range_.InternalSwap(&other->reserved_range_);
- reserved_name_.InternalSwap(&other->reserved_name_);
+ CastToBase(&field_)->InternalSwap(CastToBase(&other->field_));
+ CastToBase(&nested_type_)->InternalSwap(CastToBase(&other->nested_type_));
+ CastToBase(&enum_type_)->InternalSwap(CastToBase(&other->enum_type_));
+ CastToBase(&extension_range_)->InternalSwap(CastToBase(&other->extension_range_));
+ CastToBase(&extension_)->InternalSwap(CastToBase(&other->extension_));
+ CastToBase(&oneof_decl_)->InternalSwap(CastToBase(&other->oneof_decl_));
+ CastToBase(&reserved_range_)->InternalSwap(CastToBase(&other->reserved_range_));
+ reserved_name_.InternalSwap(CastToBase(&other->reserved_name_));
name_.Swap(&other->name_);
swap(options_, other->options_);
swap(_has_bits_[0], other->_has_bits_[0]);
@@ -4215,9 +4220,6 @@ const ExtensionRangeOptions& ExtensionRangeOptions::default_instance() {
return *internal_default_instance();
}
-ExtensionRangeOptions* ExtensionRangeOptions::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<ExtensionRangeOptions>(arena);
-}
void ExtensionRangeOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.ExtensionRangeOptions)
@@ -4245,7 +4247,8 @@ bool ExtensionRangeOptions::MergePartialFromCodedStream(
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
@@ -4288,7 +4291,9 @@ void ExtensionRangeOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 999, this->uninterpreted_option(static_cast<int>(i)), output);
+ 999,
+ this->uninterpreted_option(static_cast<int>(i)),
+ output);
}
// Extension range [1000, 536870912)
@@ -4428,7 +4433,7 @@ void ExtensionRangeOptions::UnsafeArenaSwap(ExtensionRangeOptions* other) {
}
void ExtensionRangeOptions::InternalSwap(ExtensionRangeOptions* other) {
using std::swap;
- uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
+ CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
@@ -4447,10 +4452,6 @@ void FieldDescriptorProto::InitAsDefaultInstance() {
::google::protobuf::_FieldDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::FieldOptions*>(
::google::protobuf::FieldOptions::internal_default_instance());
}
-void FieldDescriptorProto::_slow_mutable_options() {
- options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::FieldOptions >(
- GetArenaNoVirtual());
-}
void FieldDescriptorProto::unsafe_arena_set_allocated_options(
::google::protobuf::FieldOptions* options) {
if (GetArenaNoVirtual() == NULL) {
@@ -4585,9 +4586,6 @@ const FieldDescriptorProto& FieldDescriptorProto::default_instance() {
return *internal_default_instance();
}
-FieldDescriptorProto* FieldDescriptorProto::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<FieldDescriptorProto>(arena);
-}
void FieldDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FieldDescriptorProto)
@@ -4892,7 +4890,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
// optional .google.protobuf.FieldOptions options = 8;
if (cached_has_bits & 0x00000020u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 8, *this->options_, output);
+ 8, *options_, output);
}
// optional int32 oneof_index = 9;
@@ -4990,7 +4988,7 @@ void FieldDescriptorProto::SerializeWithCachedSizes(
if (cached_has_bits & 0x00000020u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 8, *this->options_, deterministic, target);
+ 8, *options_, deterministic, target);
}
// optional int32 oneof_index = 9;
@@ -5066,7 +5064,7 @@ size_t FieldDescriptorProto::ByteSizeLong() const {
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->options_);
+ *options_);
}
// optional int32 number = 3;
@@ -5235,10 +5233,6 @@ void OneofDescriptorProto::InitAsDefaultInstance() {
::google::protobuf::_OneofDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::OneofOptions*>(
::google::protobuf::OneofOptions::internal_default_instance());
}
-void OneofDescriptorProto::_slow_mutable_options() {
- options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::OneofOptions >(
- GetArenaNoVirtual());
-}
void OneofDescriptorProto::unsafe_arena_set_allocated_options(
::google::protobuf::OneofOptions* options) {
if (GetArenaNoVirtual() == NULL) {
@@ -5330,9 +5324,6 @@ const OneofDescriptorProto& OneofDescriptorProto::default_instance() {
return *internal_default_instance();
}
-OneofDescriptorProto* OneofDescriptorProto::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<OneofDescriptorProto>(arena);
-}
void OneofDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.OneofDescriptorProto)
@@ -5433,7 +5424,7 @@ void OneofDescriptorProto::SerializeWithCachedSizes(
// optional .google.protobuf.OneofOptions options = 2;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 2, *this->options_, output);
+ 2, *options_, output);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -5466,7 +5457,7 @@ void OneofDescriptorProto::SerializeWithCachedSizes(
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 2, *this->options_, deterministic, target);
+ 2, *options_, deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -5498,7 +5489,7 @@ size_t OneofDescriptorProto::ByteSizeLong() const {
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->options_);
+ *options_);
}
}
@@ -5671,9 +5662,6 @@ const EnumDescriptorProto_EnumReservedRange& EnumDescriptorProto_EnumReservedRan
return *internal_default_instance();
}
-EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto_EnumReservedRange::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<EnumDescriptorProto_EnumReservedRange>(arena);
-}
void EnumDescriptorProto_EnumReservedRange::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
@@ -5923,10 +5911,6 @@ void EnumDescriptorProto::InitAsDefaultInstance() {
::google::protobuf::_EnumDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::EnumOptions*>(
::google::protobuf::EnumOptions::internal_default_instance());
}
-void EnumDescriptorProto::_slow_mutable_options() {
- options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::EnumOptions >(
- GetArenaNoVirtual());
-}
void EnumDescriptorProto::unsafe_arena_set_allocated_options(
::google::protobuf::EnumOptions* options) {
if (GetArenaNoVirtual() == NULL) {
@@ -6027,9 +6011,6 @@ const EnumDescriptorProto& EnumDescriptorProto::default_instance() {
return *internal_default_instance();
}
-EnumDescriptorProto* EnumDescriptorProto::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<EnumDescriptorProto>(arena);
-}
void EnumDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto)
@@ -6085,7 +6066,8 @@ bool EnumDescriptorProto::MergePartialFromCodedStream(
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_value()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_value()));
} else {
goto handle_unusual;
}
@@ -6108,7 +6090,8 @@ bool EnumDescriptorProto::MergePartialFromCodedStream(
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_reserved_range()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_reserved_range()));
} else {
goto handle_unusual;
}
@@ -6173,20 +6156,24 @@ void EnumDescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->value_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 2, this->value(static_cast<int>(i)), output);
+ 2,
+ this->value(static_cast<int>(i)),
+ output);
}
// optional .google.protobuf.EnumOptions options = 3;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 3, *this->options_, output);
+ 3, *options_, output);
}
// repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->reserved_range_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 4, this->reserved_range(static_cast<int>(i)), output);
+ 4,
+ this->reserved_range(static_cast<int>(i)),
+ output);
}
// repeated string reserved_name = 5;
@@ -6237,7 +6224,7 @@ void EnumDescriptorProto::SerializeWithCachedSizes(
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 3, *this->options_, deterministic, target);
+ 3, *options_, deterministic, target);
}
// repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;
@@ -6317,7 +6304,7 @@ size_t EnumDescriptorProto::ByteSizeLong() const {
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->options_);
+ *options_);
}
}
@@ -6407,9 +6394,9 @@ void EnumDescriptorProto::UnsafeArenaSwap(EnumDescriptorProto* other) {
}
void EnumDescriptorProto::InternalSwap(EnumDescriptorProto* other) {
using std::swap;
- value_.InternalSwap(&other->value_);
- reserved_range_.InternalSwap(&other->reserved_range_);
- reserved_name_.InternalSwap(&other->reserved_name_);
+ CastToBase(&value_)->InternalSwap(CastToBase(&other->value_));
+ CastToBase(&reserved_range_)->InternalSwap(CastToBase(&other->reserved_range_));
+ reserved_name_.InternalSwap(CastToBase(&other->reserved_name_));
name_.Swap(&other->name_);
swap(options_, other->options_);
swap(_has_bits_[0], other->_has_bits_[0]);
@@ -6429,10 +6416,6 @@ void EnumValueDescriptorProto::InitAsDefaultInstance() {
::google::protobuf::_EnumValueDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::EnumValueOptions*>(
::google::protobuf::EnumValueOptions::internal_default_instance());
}
-void EnumValueDescriptorProto::_slow_mutable_options() {
- options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::EnumValueOptions >(
- GetArenaNoVirtual());
-}
void EnumValueDescriptorProto::unsafe_arena_set_allocated_options(
::google::protobuf::EnumValueOptions* options) {
if (GetArenaNoVirtual() == NULL) {
@@ -6528,9 +6511,6 @@ const EnumValueDescriptorProto& EnumValueDescriptorProto::default_instance() {
return *internal_default_instance();
}
-EnumValueDescriptorProto* EnumValueDescriptorProto::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<EnumValueDescriptorProto>(arena);
-}
void EnumValueDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueDescriptorProto)
@@ -6651,7 +6631,7 @@ void EnumValueDescriptorProto::SerializeWithCachedSizes(
// optional .google.protobuf.EnumValueOptions options = 3;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 3, *this->options_, output);
+ 3, *options_, output);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -6689,7 +6669,7 @@ void EnumValueDescriptorProto::SerializeWithCachedSizes(
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 3, *this->options_, deterministic, target);
+ 3, *options_, deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -6721,7 +6701,7 @@ size_t EnumValueDescriptorProto::ByteSizeLong() const {
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->options_);
+ *options_);
}
// optional int32 number = 2;
@@ -6838,10 +6818,6 @@ void ServiceDescriptorProto::InitAsDefaultInstance() {
::google::protobuf::_ServiceDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::ServiceOptions*>(
::google::protobuf::ServiceOptions::internal_default_instance());
}
-void ServiceDescriptorProto::_slow_mutable_options() {
- options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ServiceOptions >(
- GetArenaNoVirtual());
-}
void ServiceDescriptorProto::unsafe_arena_set_allocated_options(
::google::protobuf::ServiceOptions* options) {
if (GetArenaNoVirtual() == NULL) {
@@ -6936,9 +6912,6 @@ const ServiceDescriptorProto& ServiceDescriptorProto::default_instance() {
return *internal_default_instance();
}
-ServiceDescriptorProto* ServiceDescriptorProto::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<ServiceDescriptorProto>(arena);
-}
void ServiceDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceDescriptorProto)
@@ -6992,7 +6965,8 @@ bool ServiceDescriptorProto::MergePartialFromCodedStream(
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_method()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_method()));
} else {
goto handle_unusual;
}
@@ -7052,13 +7026,15 @@ void ServiceDescriptorProto::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->method_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 2, this->method(static_cast<int>(i)), output);
+ 2,
+ this->method(static_cast<int>(i)),
+ output);
}
// optional .google.protobuf.ServiceOptions options = 3;
if (cached_has_bits & 0x00000002u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 3, *this->options_, output);
+ 3, *options_, output);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -7099,7 +7075,7 @@ void ServiceDescriptorProto::SerializeWithCachedSizes(
if (cached_has_bits & 0x00000002u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 3, *this->options_, deterministic, target);
+ 3, *options_, deterministic, target);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -7142,7 +7118,7 @@ size_t ServiceDescriptorProto::ByteSizeLong() const {
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->options_);
+ *options_);
}
}
@@ -7230,7 +7206,7 @@ void ServiceDescriptorProto::UnsafeArenaSwap(ServiceDescriptorProto* other) {
}
void ServiceDescriptorProto::InternalSwap(ServiceDescriptorProto* other) {
using std::swap;
- method_.InternalSwap(&other->method_);
+ CastToBase(&method_)->InternalSwap(CastToBase(&other->method_));
name_.Swap(&other->name_);
swap(options_, other->options_);
swap(_has_bits_[0], other->_has_bits_[0]);
@@ -7250,10 +7226,6 @@ void MethodDescriptorProto::InitAsDefaultInstance() {
::google::protobuf::_MethodDescriptorProto_default_instance_._instance.get_mutable()->options_ = const_cast< ::google::protobuf::MethodOptions*>(
::google::protobuf::MethodOptions::internal_default_instance());
}
-void MethodDescriptorProto::_slow_mutable_options() {
- options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::MethodOptions >(
- GetArenaNoVirtual());
-}
void MethodDescriptorProto::unsafe_arena_set_allocated_options(
::google::protobuf::MethodOptions* options) {
if (GetArenaNoVirtual() == NULL) {
@@ -7368,9 +7340,6 @@ const MethodDescriptorProto& MethodDescriptorProto::default_instance() {
return *internal_default_instance();
}
-MethodDescriptorProto* MethodDescriptorProto::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<MethodDescriptorProto>(arena);
-}
void MethodDescriptorProto::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.MethodDescriptorProto)
@@ -7562,7 +7531,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes(
// optional .google.protobuf.MethodOptions options = 4;
if (cached_has_bits & 0x00000008u) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 4, *this->options_, output);
+ 4, *options_, output);
}
// optional bool client_streaming = 5 [default = false];
@@ -7627,7 +7596,7 @@ void MethodDescriptorProto::SerializeWithCachedSizes(
if (cached_has_bits & 0x00000008u) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 4, *this->options_, deterministic, target);
+ 4, *options_, deterministic, target);
}
// optional bool client_streaming = 5 [default = false];
@@ -7683,7 +7652,7 @@ size_t MethodDescriptorProto::ByteSizeLong() const {
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->options_);
+ *options_);
}
// optional bool client_streaming = 5 [default = false];
@@ -7961,9 +7930,6 @@ const FileOptions& FileOptions::default_instance() {
return *internal_default_instance();
}
-FileOptions* FileOptions::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<FileOptions>(arena);
-}
void FileOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FileOptions)
@@ -8309,7 +8275,8 @@ bool FileOptions::MergePartialFromCodedStream(
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
@@ -8484,7 +8451,9 @@ void FileOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 999, this->uninterpreted_option(static_cast<int>(i)), output);
+ 999,
+ this->uninterpreted_option(static_cast<int>(i)),
+ output);
}
// Extension range [1000, 536870912)
@@ -8940,7 +8909,7 @@ void FileOptions::UnsafeArenaSwap(FileOptions* other) {
}
void FileOptions::InternalSwap(FileOptions* other) {
using std::swap;
- uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
+ CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
java_package_.Swap(&other->java_package_);
java_outer_classname_.Swap(&other->java_outer_classname_);
go_package_.Swap(&other->go_package_);
@@ -9052,9 +9021,6 @@ const MessageOptions& MessageOptions::default_instance() {
return *internal_default_instance();
}
-MessageOptions* MessageOptions::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<MessageOptions>(arena);
-}
void MessageOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.MessageOptions)
@@ -9141,7 +9107,8 @@ bool MessageOptions::MergePartialFromCodedStream(
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
@@ -9205,7 +9172,9 @@ void MessageOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 999, this->uninterpreted_option(static_cast<int>(i)), output);
+ 999,
+ this->uninterpreted_option(static_cast<int>(i)),
+ output);
}
// Extension range [1000, 536870912)
@@ -9404,7 +9373,7 @@ void MessageOptions::UnsafeArenaSwap(MessageOptions* other) {
}
void MessageOptions::InternalSwap(MessageOptions* other) {
using std::swap;
- uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
+ CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
swap(message_set_wire_format_, other->message_set_wire_format_);
swap(no_standard_descriptor_accessor_, other->no_standard_descriptor_accessor_);
swap(deprecated_, other->deprecated_);
@@ -9504,9 +9473,6 @@ const FieldOptions& FieldOptions::default_instance() {
return *internal_default_instance();
}
-FieldOptions* FieldOptions::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<FieldOptions>(arena);
-}
void FieldOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FieldOptions)
@@ -9636,7 +9602,8 @@ bool FieldOptions::MergePartialFromCodedStream(
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
@@ -9712,7 +9679,9 @@ void FieldOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 999, this->uninterpreted_option(static_cast<int>(i)), output);
+ 999,
+ this->uninterpreted_option(static_cast<int>(i)),
+ output);
}
// Extension range [1000, 536870912)
@@ -9941,7 +9910,7 @@ void FieldOptions::UnsafeArenaSwap(FieldOptions* other) {
}
void FieldOptions::InternalSwap(FieldOptions* other) {
using std::swap;
- uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
+ CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
swap(ctype_, other->ctype_);
swap(packed_, other->packed_);
swap(lazy_, other->lazy_);
@@ -10031,9 +10000,6 @@ const OneofOptions& OneofOptions::default_instance() {
return *internal_default_instance();
}
-OneofOptions* OneofOptions::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<OneofOptions>(arena);
-}
void OneofOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.OneofOptions)
@@ -10061,7 +10027,8 @@ bool OneofOptions::MergePartialFromCodedStream(
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
@@ -10104,7 +10071,9 @@ void OneofOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 999, this->uninterpreted_option(static_cast<int>(i)), output);
+ 999,
+ this->uninterpreted_option(static_cast<int>(i)),
+ output);
}
// Extension range [1000, 536870912)
@@ -10244,7 +10213,7 @@ void OneofOptions::UnsafeArenaSwap(OneofOptions* other) {
}
void OneofOptions::InternalSwap(OneofOptions* other) {
using std::swap;
- uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
+ CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
@@ -10336,9 +10305,6 @@ const EnumOptions& EnumOptions::default_instance() {
return *internal_default_instance();
}
-EnumOptions* EnumOptions::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<EnumOptions>(arena);
-}
void EnumOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumOptions)
@@ -10397,7 +10363,8 @@ bool EnumOptions::MergePartialFromCodedStream(
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
@@ -10451,7 +10418,9 @@ void EnumOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 999, this->uninterpreted_option(static_cast<int>(i)), output);
+ 999,
+ this->uninterpreted_option(static_cast<int>(i)),
+ output);
}
// Extension range [1000, 536870912)
@@ -10624,7 +10593,7 @@ void EnumOptions::UnsafeArenaSwap(EnumOptions* other) {
}
void EnumOptions::InternalSwap(EnumOptions* other) {
using std::swap;
- uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
+ CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
swap(allow_alias_, other->allow_alias_);
swap(deprecated_, other->deprecated_);
swap(_has_bits_[0], other->_has_bits_[0]);
@@ -10713,9 +10682,6 @@ const EnumValueOptions& EnumValueOptions::default_instance() {
return *internal_default_instance();
}
-EnumValueOptions* EnumValueOptions::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<EnumValueOptions>(arena);
-}
void EnumValueOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueOptions)
@@ -10758,7 +10724,8 @@ bool EnumValueOptions::MergePartialFromCodedStream(
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
@@ -10807,7 +10774,9 @@ void EnumValueOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 999, this->uninterpreted_option(static_cast<int>(i)), output);
+ 999,
+ this->uninterpreted_option(static_cast<int>(i)),
+ output);
}
// Extension range [1000, 536870912)
@@ -10961,7 +10930,7 @@ void EnumValueOptions::UnsafeArenaSwap(EnumValueOptions* other) {
}
void EnumValueOptions::InternalSwap(EnumValueOptions* other) {
using std::swap;
- uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
+ CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
swap(deprecated_, other->deprecated_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
@@ -11049,9 +11018,6 @@ const ServiceOptions& ServiceOptions::default_instance() {
return *internal_default_instance();
}
-ServiceOptions* ServiceOptions::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<ServiceOptions>(arena);
-}
void ServiceOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceOptions)
@@ -11094,7 +11060,8 @@ bool ServiceOptions::MergePartialFromCodedStream(
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
@@ -11143,7 +11110,9 @@ void ServiceOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 999, this->uninterpreted_option(static_cast<int>(i)), output);
+ 999,
+ this->uninterpreted_option(static_cast<int>(i)),
+ output);
}
// Extension range [1000, 536870912)
@@ -11297,7 +11266,7 @@ void ServiceOptions::UnsafeArenaSwap(ServiceOptions* other) {
}
void ServiceOptions::InternalSwap(ServiceOptions* other) {
using std::swap;
- uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
+ CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
swap(deprecated_, other->deprecated_);
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
@@ -11390,9 +11359,6 @@ const MethodOptions& MethodOptions::default_instance() {
return *internal_default_instance();
}
-MethodOptions* MethodOptions::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<MethodOptions>(arena);
-}
void MethodOptions::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.MethodOptions)
@@ -11460,7 +11426,8 @@ bool MethodOptions::MergePartialFromCodedStream(
case 999: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u /* 7994 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_uninterpreted_option()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_uninterpreted_option()));
} else {
goto handle_unusual;
}
@@ -11515,7 +11482,9 @@ void MethodOptions::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->uninterpreted_option_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 999, this->uninterpreted_option(static_cast<int>(i)), output);
+ 999,
+ this->uninterpreted_option(static_cast<int>(i)),
+ output);
}
// Extension range [1000, 536870912)
@@ -11690,7 +11659,7 @@ void MethodOptions::UnsafeArenaSwap(MethodOptions* other) {
}
void MethodOptions::InternalSwap(MethodOptions* other) {
using std::swap;
- uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
+ CastToBase(&uninterpreted_option_)->InternalSwap(CastToBase(&other->uninterpreted_option_));
swap(deprecated_, other->deprecated_);
swap(idempotency_level_, other->idempotency_level_);
swap(_has_bits_[0], other->_has_bits_[0]);
@@ -11782,9 +11751,6 @@ const UninterpretedOption_NamePart& UninterpretedOption_NamePart::default_instan
return *internal_default_instance();
}
-UninterpretedOption_NamePart* UninterpretedOption_NamePart::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<UninterpretedOption_NamePart>(arena);
-}
void UninterpretedOption_NamePart::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption.NamePart)
@@ -12158,9 +12124,6 @@ const UninterpretedOption& UninterpretedOption::default_instance() {
return *internal_default_instance();
}
-UninterpretedOption* UninterpretedOption::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<UninterpretedOption>(arena);
-}
void UninterpretedOption::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption)
@@ -12207,7 +12170,8 @@ bool UninterpretedOption::MergePartialFromCodedStream(
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_name()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_name()));
} else {
goto handle_unusual;
}
@@ -12330,7 +12294,9 @@ void UninterpretedOption::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->name_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 2, this->name(static_cast<int>(i)), output);
+ 2,
+ this->name(static_cast<int>(i)),
+ output);
}
cached_has_bits = _has_bits_[0];
@@ -12606,7 +12572,7 @@ void UninterpretedOption::UnsafeArenaSwap(UninterpretedOption* other) {
}
void UninterpretedOption::InternalSwap(UninterpretedOption* other) {
using std::swap;
- name_.InternalSwap(&other->name_);
+ CastToBase(&name_)->InternalSwap(CastToBase(&other->name_));
identifier_value_.Swap(&other->identifier_value_);
string_value_.Swap(&other->string_value_);
aggregate_value_.Swap(&other->aggregate_value_);
@@ -12715,9 +12681,6 @@ const SourceCodeInfo_Location& SourceCodeInfo_Location::default_instance() {
return *internal_default_instance();
}
-SourceCodeInfo_Location* SourceCodeInfo_Location::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<SourceCodeInfo_Location>(arena);
-}
void SourceCodeInfo_Location::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo.Location)
@@ -13149,7 +13112,7 @@ void SourceCodeInfo_Location::InternalSwap(SourceCodeInfo_Location* other) {
using std::swap;
path_.InternalSwap(&other->path_);
span_.InternalSwap(&other->span_);
- leading_detached_comments_.InternalSwap(&other->leading_detached_comments_);
+ leading_detached_comments_.InternalSwap(CastToBase(&other->leading_detached_comments_));
leading_comments_.Swap(&other->leading_comments_);
trailing_comments_.Swap(&other->trailing_comments_);
swap(_has_bits_[0], other->_has_bits_[0]);
@@ -13232,9 +13195,6 @@ const SourceCodeInfo& SourceCodeInfo::default_instance() {
return *internal_default_instance();
}
-SourceCodeInfo* SourceCodeInfo::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<SourceCodeInfo>(arena);
-}
void SourceCodeInfo::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo)
@@ -13261,7 +13221,8 @@ bool SourceCodeInfo::MergePartialFromCodedStream(
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_location()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_location()));
} else {
goto handle_unusual;
}
@@ -13298,7 +13259,9 @@ void SourceCodeInfo::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->location_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 1, this->location(static_cast<int>(i)), output);
+ 1,
+ this->location(static_cast<int>(i)),
+ output);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -13422,7 +13385,7 @@ void SourceCodeInfo::UnsafeArenaSwap(SourceCodeInfo* other) {
}
void SourceCodeInfo::InternalSwap(SourceCodeInfo* other) {
using std::swap;
- location_.InternalSwap(&other->location_);
+ CastToBase(&location_)->InternalSwap(CastToBase(&other->location_));
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
@@ -13519,9 +13482,6 @@ const GeneratedCodeInfo_Annotation& GeneratedCodeInfo_Annotation::default_instan
return *internal_default_instance();
}
-GeneratedCodeInfo_Annotation* GeneratedCodeInfo_Annotation::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<GeneratedCodeInfo_Annotation>(arena);
-}
void GeneratedCodeInfo_Annotation::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo.Annotation)
@@ -13948,9 +13908,6 @@ const GeneratedCodeInfo& GeneratedCodeInfo::default_instance() {
return *internal_default_instance();
}
-GeneratedCodeInfo* GeneratedCodeInfo::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<GeneratedCodeInfo>(arena);
-}
void GeneratedCodeInfo::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo)
@@ -13977,7 +13934,8 @@ bool GeneratedCodeInfo::MergePartialFromCodedStream(
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_annotation()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_annotation()));
} else {
goto handle_unusual;
}
@@ -14014,7 +13972,9 @@ void GeneratedCodeInfo::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->annotation_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 1, this->annotation(static_cast<int>(i)), output);
+ 1,
+ this->annotation(static_cast<int>(i)),
+ output);
}
if (_internal_metadata_.have_unknown_fields()) {
@@ -14138,7 +14098,7 @@ void GeneratedCodeInfo::UnsafeArenaSwap(GeneratedCodeInfo* other) {
}
void GeneratedCodeInfo::InternalSwap(GeneratedCodeInfo* other) {
using std::swap;
- annotation_.InternalSwap(&other->annotation_);
+ CastToBase(&annotation_)->InternalSwap(CastToBase(&other->annotation_));
swap(_has_bits_[0], other->_has_bits_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
@@ -14153,5 +14113,90 @@ void GeneratedCodeInfo::InternalSwap(GeneratedCodeInfo* other) {
// @@protoc_insertion_point(namespace_scope)
} // namespace protobuf
} // namespace google
+namespace google {
+namespace protobuf {
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::FileDescriptorSet* Arena::CreateMessage< ::google::protobuf::FileDescriptorSet >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::FileDescriptorSet >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::FileDescriptorProto* Arena::CreateMessage< ::google::protobuf::FileDescriptorProto >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::FileDescriptorProto >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::DescriptorProto_ExtensionRange* Arena::CreateMessage< ::google::protobuf::DescriptorProto_ExtensionRange >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::DescriptorProto_ExtensionRange >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::DescriptorProto_ReservedRange* Arena::CreateMessage< ::google::protobuf::DescriptorProto_ReservedRange >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::DescriptorProto_ReservedRange >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::DescriptorProto* Arena::CreateMessage< ::google::protobuf::DescriptorProto >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::DescriptorProto >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::ExtensionRangeOptions* Arena::CreateMessage< ::google::protobuf::ExtensionRangeOptions >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::ExtensionRangeOptions >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::FieldDescriptorProto* Arena::CreateMessage< ::google::protobuf::FieldDescriptorProto >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::FieldDescriptorProto >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::OneofDescriptorProto* Arena::CreateMessage< ::google::protobuf::OneofDescriptorProto >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::OneofDescriptorProto >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::EnumDescriptorProto_EnumReservedRange* Arena::CreateMessage< ::google::protobuf::EnumDescriptorProto_EnumReservedRange >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::EnumDescriptorProto_EnumReservedRange >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::EnumDescriptorProto* Arena::CreateMessage< ::google::protobuf::EnumDescriptorProto >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::EnumDescriptorProto >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::EnumValueDescriptorProto* Arena::CreateMessage< ::google::protobuf::EnumValueDescriptorProto >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::EnumValueDescriptorProto >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::ServiceDescriptorProto* Arena::CreateMessage< ::google::protobuf::ServiceDescriptorProto >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::ServiceDescriptorProto >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::MethodDescriptorProto* Arena::CreateMessage< ::google::protobuf::MethodDescriptorProto >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::MethodDescriptorProto >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::FileOptions* Arena::CreateMessage< ::google::protobuf::FileOptions >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::FileOptions >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::MessageOptions* Arena::CreateMessage< ::google::protobuf::MessageOptions >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::MessageOptions >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::FieldOptions* Arena::CreateMessage< ::google::protobuf::FieldOptions >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::FieldOptions >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::OneofOptions* Arena::CreateMessage< ::google::protobuf::OneofOptions >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::OneofOptions >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::EnumOptions* Arena::CreateMessage< ::google::protobuf::EnumOptions >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::EnumOptions >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::EnumValueOptions* Arena::CreateMessage< ::google::protobuf::EnumValueOptions >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::EnumValueOptions >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::ServiceOptions* Arena::CreateMessage< ::google::protobuf::ServiceOptions >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::ServiceOptions >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::MethodOptions* Arena::CreateMessage< ::google::protobuf::MethodOptions >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::MethodOptions >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::UninterpretedOption_NamePart* Arena::CreateMessage< ::google::protobuf::UninterpretedOption_NamePart >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::UninterpretedOption_NamePart >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::UninterpretedOption* Arena::CreateMessage< ::google::protobuf::UninterpretedOption >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::UninterpretedOption >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::SourceCodeInfo_Location* Arena::CreateMessage< ::google::protobuf::SourceCodeInfo_Location >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::SourceCodeInfo_Location >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::SourceCodeInfo* Arena::CreateMessage< ::google::protobuf::SourceCodeInfo >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::SourceCodeInfo >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::GeneratedCodeInfo_Annotation* Arena::CreateMessage< ::google::protobuf::GeneratedCodeInfo_Annotation >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::GeneratedCodeInfo_Annotation >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::GeneratedCodeInfo* Arena::CreateMessage< ::google::protobuf::GeneratedCodeInfo >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::GeneratedCodeInfo >(arena);
+}
+} // namespace protobuf
+} // namespace google
// @@protoc_insertion_point(global_scope)
diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h
index 4ed5cac9..4ec0a5b4 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -1,8 +1,8 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/descriptor.proto
-#ifndef PROTOBUF_google_2fprotobuf_2fdescriptor_2eproto__INCLUDED
-#define PROTOBUF_google_2fprotobuf_2fdescriptor_2eproto__INCLUDED
+#ifndef PROTOBUF_google_2fprotobuf_2fdescriptor_2eproto_INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fdescriptor_2eproto_INCLUDED
#include <string>
@@ -214,6 +214,37 @@ LIBPROTOBUF_EXPORT extern UninterpretedOption_NamePartDefaultTypeInternal _Unint
} // namespace google
namespace google {
namespace protobuf {
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::DescriptorProto* Arena::CreateMessage< ::google::protobuf::DescriptorProto>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::DescriptorProto_ExtensionRange* Arena::CreateMessage< ::google::protobuf::DescriptorProto_ExtensionRange>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::DescriptorProto_ReservedRange* Arena::CreateMessage< ::google::protobuf::DescriptorProto_ReservedRange>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::EnumDescriptorProto* Arena::CreateMessage< ::google::protobuf::EnumDescriptorProto>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::EnumDescriptorProto_EnumReservedRange* Arena::CreateMessage< ::google::protobuf::EnumDescriptorProto_EnumReservedRange>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::EnumOptions* Arena::CreateMessage< ::google::protobuf::EnumOptions>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::EnumValueDescriptorProto* Arena::CreateMessage< ::google::protobuf::EnumValueDescriptorProto>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::EnumValueOptions* Arena::CreateMessage< ::google::protobuf::EnumValueOptions>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::ExtensionRangeOptions* Arena::CreateMessage< ::google::protobuf::ExtensionRangeOptions>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::FieldDescriptorProto* Arena::CreateMessage< ::google::protobuf::FieldDescriptorProto>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::FieldOptions* Arena::CreateMessage< ::google::protobuf::FieldOptions>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::FileDescriptorProto* Arena::CreateMessage< ::google::protobuf::FileDescriptorProto>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::FileDescriptorSet* Arena::CreateMessage< ::google::protobuf::FileDescriptorSet>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::FileOptions* Arena::CreateMessage< ::google::protobuf::FileOptions>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::GeneratedCodeInfo* Arena::CreateMessage< ::google::protobuf::GeneratedCodeInfo>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::GeneratedCodeInfo_Annotation* Arena::CreateMessage< ::google::protobuf::GeneratedCodeInfo_Annotation>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::MessageOptions* Arena::CreateMessage< ::google::protobuf::MessageOptions>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::MethodDescriptorProto* Arena::CreateMessage< ::google::protobuf::MethodDescriptorProto>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::MethodOptions* Arena::CreateMessage< ::google::protobuf::MethodOptions>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::OneofDescriptorProto* Arena::CreateMessage< ::google::protobuf::OneofDescriptorProto>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::OneofOptions* Arena::CreateMessage< ::google::protobuf::OneofOptions>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::ServiceDescriptorProto* Arena::CreateMessage< ::google::protobuf::ServiceDescriptorProto>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::ServiceOptions* Arena::CreateMessage< ::google::protobuf::ServiceOptions>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::SourceCodeInfo* Arena::CreateMessage< ::google::protobuf::SourceCodeInfo>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::SourceCodeInfo_Location* Arena::CreateMessage< ::google::protobuf::SourceCodeInfo_Location>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::UninterpretedOption* Arena::CreateMessage< ::google::protobuf::UninterpretedOption>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::UninterpretedOption_NamePart* Arena::CreateMessage< ::google::protobuf::UninterpretedOption_NamePart>(Arena*);
+} // namespace protobuf
+} // namespace google
+namespace google {
+namespace protobuf {
enum FieldDescriptorProto_Type {
FieldDescriptorProto_Type_TYPE_DOUBLE = 1,
@@ -410,9 +441,13 @@ class LIBPROTOBUF_EXPORT FileDescriptorSet : public ::google::protobuf::Message
// implements Message ----------------------------------------------
- inline FileDescriptorSet* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline FileDescriptorSet* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<FileDescriptorSet>(NULL);
+ }
- FileDescriptorSet* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ FileDescriptorSet* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<FileDescriptorSet>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const FileDescriptorSet& from);
@@ -457,11 +492,11 @@ class LIBPROTOBUF_EXPORT FileDescriptorSet : public ::google::protobuf::Message
int file_size() const;
void clear_file();
static const int kFileFieldNumber = 1;
- const ::google::protobuf::FileDescriptorProto& file(int index) const;
::google::protobuf::FileDescriptorProto* mutable_file(int index);
- ::google::protobuf::FileDescriptorProto* add_file();
::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >*
mutable_file();
+ const ::google::protobuf::FileDescriptorProto& file(int index) const;
+ ::google::protobuf::FileDescriptorProto* add_file();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >&
file() const;
@@ -538,9 +573,13 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
// implements Message ----------------------------------------------
- inline FileDescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline FileDescriptorProto* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<FileDescriptorProto>(NULL);
+ }
- FileDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ FileDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<FileDescriptorProto>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const FileDescriptorProto& from);
@@ -607,11 +646,11 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
int message_type_size() const;
void clear_message_type();
static const int kMessageTypeFieldNumber = 4;
- const ::google::protobuf::DescriptorProto& message_type(int index) const;
::google::protobuf::DescriptorProto* mutable_message_type(int index);
- ::google::protobuf::DescriptorProto* add_message_type();
::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >*
mutable_message_type();
+ const ::google::protobuf::DescriptorProto& message_type(int index) const;
+ ::google::protobuf::DescriptorProto* add_message_type();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >&
message_type() const;
@@ -619,11 +658,11 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
int enum_type_size() const;
void clear_enum_type();
static const int kEnumTypeFieldNumber = 5;
- const ::google::protobuf::EnumDescriptorProto& enum_type(int index) const;
::google::protobuf::EnumDescriptorProto* mutable_enum_type(int index);
- ::google::protobuf::EnumDescriptorProto* add_enum_type();
::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >*
mutable_enum_type();
+ const ::google::protobuf::EnumDescriptorProto& enum_type(int index) const;
+ ::google::protobuf::EnumDescriptorProto* add_enum_type();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >&
enum_type() const;
@@ -631,11 +670,11 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
int service_size() const;
void clear_service();
static const int kServiceFieldNumber = 6;
- const ::google::protobuf::ServiceDescriptorProto& service(int index) const;
::google::protobuf::ServiceDescriptorProto* mutable_service(int index);
- ::google::protobuf::ServiceDescriptorProto* add_service();
::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >*
mutable_service();
+ const ::google::protobuf::ServiceDescriptorProto& service(int index) const;
+ ::google::protobuf::ServiceDescriptorProto* add_service();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >&
service() const;
@@ -643,11 +682,11 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
int extension_size() const;
void clear_extension();
static const int kExtensionFieldNumber = 7;
- const ::google::protobuf::FieldDescriptorProto& extension(int index) const;
::google::protobuf::FieldDescriptorProto* mutable_extension(int index);
- ::google::protobuf::FieldDescriptorProto* add_extension();
::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >*
mutable_extension();
+ const ::google::protobuf::FieldDescriptorProto& extension(int index) const;
+ ::google::protobuf::FieldDescriptorProto* add_extension();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >&
extension() const;
@@ -751,9 +790,6 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 8;
- private:
- void _slow_mutable_options();
- public:
const ::google::protobuf::FileOptions& options() const;
::google::protobuf::FileOptions* release_options();
::google::protobuf::FileOptions* mutable_options();
@@ -766,9 +802,6 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
bool has_source_code_info() const;
void clear_source_code_info();
static const int kSourceCodeInfoFieldNumber = 9;
- private:
- void _slow_mutable_source_code_info();
- public:
const ::google::protobuf::SourceCodeInfo& source_code_info() const;
::google::protobuf::SourceCodeInfo* release_source_code_info();
::google::protobuf::SourceCodeInfo* mutable_source_code_info();
@@ -871,9 +904,13 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto
// implements Message ----------------------------------------------
- inline DescriptorProto_ExtensionRange* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline DescriptorProto_ExtensionRange* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<DescriptorProto_ExtensionRange>(NULL);
+ }
- DescriptorProto_ExtensionRange* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ DescriptorProto_ExtensionRange* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<DescriptorProto_ExtensionRange>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const DescriptorProto_ExtensionRange& from);
@@ -918,9 +955,6 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 3;
- private:
- void _slow_mutable_options();
- public:
const ::google::protobuf::ExtensionRangeOptions& options() const;
::google::protobuf::ExtensionRangeOptions* release_options();
::google::protobuf::ExtensionRangeOptions* mutable_options();
@@ -1024,9 +1058,13 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ReservedRange : public ::google::protob
// implements Message ----------------------------------------------
- inline DescriptorProto_ReservedRange* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline DescriptorProto_ReservedRange* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<DescriptorProto_ReservedRange>(NULL);
+ }
- DescriptorProto_ReservedRange* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ DescriptorProto_ReservedRange* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<DescriptorProto_ReservedRange>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const DescriptorProto_ReservedRange& from);
@@ -1159,9 +1197,13 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /*
// implements Message ----------------------------------------------
- inline DescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline DescriptorProto* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<DescriptorProto>(NULL);
+ }
- DescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ DescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<DescriptorProto>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const DescriptorProto& from);
@@ -1209,11 +1251,11 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /*
int field_size() const;
void clear_field();
static const int kFieldFieldNumber = 2;
- const ::google::protobuf::FieldDescriptorProto& field(int index) const;
::google::protobuf::FieldDescriptorProto* mutable_field(int index);
- ::google::protobuf::FieldDescriptorProto* add_field();
::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >*
mutable_field();
+ const ::google::protobuf::FieldDescriptorProto& field(int index) const;
+ ::google::protobuf::FieldDescriptorProto* add_field();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >&
field() const;
@@ -1221,11 +1263,11 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /*
int nested_type_size() const;
void clear_nested_type();
static const int kNestedTypeFieldNumber = 3;
- const ::google::protobuf::DescriptorProto& nested_type(int index) const;
::google::protobuf::DescriptorProto* mutable_nested_type(int index);
- ::google::protobuf::DescriptorProto* add_nested_type();
::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >*
mutable_nested_type();
+ const ::google::protobuf::DescriptorProto& nested_type(int index) const;
+ ::google::protobuf::DescriptorProto* add_nested_type();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >&
nested_type() const;
@@ -1233,11 +1275,11 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /*
int enum_type_size() const;
void clear_enum_type();
static const int kEnumTypeFieldNumber = 4;
- const ::google::protobuf::EnumDescriptorProto& enum_type(int index) const;
::google::protobuf::EnumDescriptorProto* mutable_enum_type(int index);
- ::google::protobuf::EnumDescriptorProto* add_enum_type();
::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >*
mutable_enum_type();
+ const ::google::protobuf::EnumDescriptorProto& enum_type(int index) const;
+ ::google::protobuf::EnumDescriptorProto* add_enum_type();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >&
enum_type() const;
@@ -1245,11 +1287,11 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /*
int extension_range_size() const;
void clear_extension_range();
static const int kExtensionRangeFieldNumber = 5;
- const ::google::protobuf::DescriptorProto_ExtensionRange& extension_range(int index) const;
::google::protobuf::DescriptorProto_ExtensionRange* mutable_extension_range(int index);
- ::google::protobuf::DescriptorProto_ExtensionRange* add_extension_range();
::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >*
mutable_extension_range();
+ const ::google::protobuf::DescriptorProto_ExtensionRange& extension_range(int index) const;
+ ::google::protobuf::DescriptorProto_ExtensionRange* add_extension_range();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >&
extension_range() const;
@@ -1257,11 +1299,11 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /*
int extension_size() const;
void clear_extension();
static const int kExtensionFieldNumber = 6;
- const ::google::protobuf::FieldDescriptorProto& extension(int index) const;
::google::protobuf::FieldDescriptorProto* mutable_extension(int index);
- ::google::protobuf::FieldDescriptorProto* add_extension();
::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >*
mutable_extension();
+ const ::google::protobuf::FieldDescriptorProto& extension(int index) const;
+ ::google::protobuf::FieldDescriptorProto* add_extension();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >&
extension() const;
@@ -1269,11 +1311,11 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /*
int oneof_decl_size() const;
void clear_oneof_decl();
static const int kOneofDeclFieldNumber = 8;
- const ::google::protobuf::OneofDescriptorProto& oneof_decl(int index) const;
::google::protobuf::OneofDescriptorProto* mutable_oneof_decl(int index);
- ::google::protobuf::OneofDescriptorProto* add_oneof_decl();
::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto >*
mutable_oneof_decl();
+ const ::google::protobuf::OneofDescriptorProto& oneof_decl(int index) const;
+ ::google::protobuf::OneofDescriptorProto* add_oneof_decl();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto >&
oneof_decl() const;
@@ -1281,11 +1323,11 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /*
int reserved_range_size() const;
void clear_reserved_range();
static const int kReservedRangeFieldNumber = 9;
- const ::google::protobuf::DescriptorProto_ReservedRange& reserved_range(int index) const;
::google::protobuf::DescriptorProto_ReservedRange* mutable_reserved_range(int index);
- ::google::protobuf::DescriptorProto_ReservedRange* add_reserved_range();
::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ReservedRange >*
mutable_reserved_range();
+ const ::google::protobuf::DescriptorProto_ReservedRange& reserved_range(int index) const;
+ ::google::protobuf::DescriptorProto_ReservedRange* add_reserved_range();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ReservedRange >&
reserved_range() const;
@@ -1339,9 +1381,6 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message /*
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 7;
- private:
- void _slow_mutable_options();
- public:
const ::google::protobuf::MessageOptions& options() const;
::google::protobuf::MessageOptions* release_options();
::google::protobuf::MessageOptions* mutable_options();
@@ -1436,9 +1475,13 @@ class LIBPROTOBUF_EXPORT ExtensionRangeOptions : public ::google::protobuf::Mess
// implements Message ----------------------------------------------
- inline ExtensionRangeOptions* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline ExtensionRangeOptions* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<ExtensionRangeOptions>(NULL);
+ }
- ExtensionRangeOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ ExtensionRangeOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<ExtensionRangeOptions>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const ExtensionRangeOptions& from);
@@ -1483,11 +1526,11 @@ class LIBPROTOBUF_EXPORT ExtensionRangeOptions : public ::google::protobuf::Mess
int uninterpreted_option_size() const;
void clear_uninterpreted_option();
static const int kUninterpretedOptionFieldNumber = 999;
- const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index);
- ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
mutable_uninterpreted_option();
+ const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
+ ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
uninterpreted_option() const;
@@ -1567,9 +1610,13 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa
// implements Message ----------------------------------------------
- inline FieldDescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline FieldDescriptorProto* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<FieldDescriptorProto>(NULL);
+ }
- FieldDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ FieldDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<FieldDescriptorProto>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const FieldDescriptorProto& from);
@@ -1820,9 +1867,6 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 8;
- private:
- void _slow_mutable_options();
- public:
const ::google::protobuf::FieldOptions& options() const;
::google::protobuf::FieldOptions* release_options();
::google::protobuf::FieldOptions* mutable_options();
@@ -1961,9 +2005,13 @@ class LIBPROTOBUF_EXPORT OneofDescriptorProto : public ::google::protobuf::Messa
// implements Message ----------------------------------------------
- inline OneofDescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline OneofDescriptorProto* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<OneofDescriptorProto>(NULL);
+ }
- OneofDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ OneofDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<OneofDescriptorProto>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const OneofDescriptorProto& from);
@@ -2032,9 +2080,6 @@ class LIBPROTOBUF_EXPORT OneofDescriptorProto : public ::google::protobuf::Messa
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 2;
- private:
- void _slow_mutable_options();
- public:
const ::google::protobuf::OneofOptions& options() const;
::google::protobuf::OneofOptions* release_options();
::google::protobuf::OneofOptions* mutable_options();
@@ -2121,9 +2166,13 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange : public ::google
// implements Message ----------------------------------------------
- inline EnumDescriptorProto_EnumReservedRange* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline EnumDescriptorProto_EnumReservedRange* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<EnumDescriptorProto_EnumReservedRange>(NULL);
+ }
- EnumDescriptorProto_EnumReservedRange* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ EnumDescriptorProto_EnumReservedRange* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<EnumDescriptorProto_EnumReservedRange>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const EnumDescriptorProto_EnumReservedRange& from);
@@ -2256,9 +2305,13 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag
// implements Message ----------------------------------------------
- inline EnumDescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline EnumDescriptorProto* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<EnumDescriptorProto>(NULL);
+ }
- EnumDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ EnumDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<EnumDescriptorProto>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const EnumDescriptorProto& from);
@@ -2305,11 +2358,11 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag
int value_size() const;
void clear_value();
static const int kValueFieldNumber = 2;
- const ::google::protobuf::EnumValueDescriptorProto& value(int index) const;
::google::protobuf::EnumValueDescriptorProto* mutable_value(int index);
- ::google::protobuf::EnumValueDescriptorProto* add_value();
::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >*
mutable_value();
+ const ::google::protobuf::EnumValueDescriptorProto& value(int index) const;
+ ::google::protobuf::EnumValueDescriptorProto* add_value();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >&
value() const;
@@ -2317,11 +2370,11 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag
int reserved_range_size() const;
void clear_reserved_range();
static const int kReservedRangeFieldNumber = 4;
- const ::google::protobuf::EnumDescriptorProto_EnumReservedRange& reserved_range(int index) const;
::google::protobuf::EnumDescriptorProto_EnumReservedRange* mutable_reserved_range(int index);
- ::google::protobuf::EnumDescriptorProto_EnumReservedRange* add_reserved_range();
::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto_EnumReservedRange >*
mutable_reserved_range();
+ const ::google::protobuf::EnumDescriptorProto_EnumReservedRange& reserved_range(int index) const;
+ ::google::protobuf::EnumDescriptorProto_EnumReservedRange* add_reserved_range();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto_EnumReservedRange >&
reserved_range() const;
@@ -2375,9 +2428,6 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 3;
- private:
- void _slow_mutable_options();
- public:
const ::google::protobuf::EnumOptions& options() const;
::google::protobuf::EnumOptions* release_options();
::google::protobuf::EnumOptions* mutable_options();
@@ -2467,9 +2517,13 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M
// implements Message ----------------------------------------------
- inline EnumValueDescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline EnumValueDescriptorProto* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<EnumValueDescriptorProto>(NULL);
+ }
- EnumValueDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ EnumValueDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<EnumValueDescriptorProto>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const EnumValueDescriptorProto& from);
@@ -2538,9 +2592,6 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 3;
- private:
- void _slow_mutable_options();
- public:
const ::google::protobuf::EnumValueOptions& options() const;
::google::protobuf::EnumValueOptions* release_options();
::google::protobuf::EnumValueOptions* mutable_options();
@@ -2637,9 +2688,13 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes
// implements Message ----------------------------------------------
- inline ServiceDescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline ServiceDescriptorProto* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<ServiceDescriptorProto>(NULL);
+ }
- ServiceDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ ServiceDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<ServiceDescriptorProto>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const ServiceDescriptorProto& from);
@@ -2684,11 +2739,11 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes
int method_size() const;
void clear_method();
static const int kMethodFieldNumber = 2;
- const ::google::protobuf::MethodDescriptorProto& method(int index) const;
::google::protobuf::MethodDescriptorProto* mutable_method(int index);
- ::google::protobuf::MethodDescriptorProto* add_method();
::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >*
mutable_method();
+ const ::google::protobuf::MethodDescriptorProto& method(int index) const;
+ ::google::protobuf::MethodDescriptorProto* add_method();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >&
method() const;
@@ -2720,9 +2775,6 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 3;
- private:
- void _slow_mutable_options();
- public:
const ::google::protobuf::ServiceOptions& options() const;
::google::protobuf::ServiceOptions* release_options();
::google::protobuf::ServiceOptions* mutable_options();
@@ -2810,9 +2862,13 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess
// implements Message ----------------------------------------------
- inline MethodDescriptorProto* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline MethodDescriptorProto* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<MethodDescriptorProto>(NULL);
+ }
- MethodDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ MethodDescriptorProto* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<MethodDescriptorProto>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const MethodDescriptorProto& from);
@@ -2929,9 +2985,6 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess
bool has_options() const;
void clear_options();
static const int kOptionsFieldNumber = 4;
- private:
- void _slow_mutable_options();
- public:
const ::google::protobuf::MethodOptions& options() const;
::google::protobuf::MethodOptions* release_options();
::google::protobuf::MethodOptions* mutable_options();
@@ -3044,9 +3097,13 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
// implements Message ----------------------------------------------
- inline FileOptions* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline FileOptions* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<FileOptions>(NULL);
+ }
- FileOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ FileOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<FileOptions>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const FileOptions& from);
@@ -3119,11 +3176,11 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message /* @@p
int uninterpreted_option_size() const;
void clear_uninterpreted_option();
static const int kUninterpretedOptionFieldNumber = 999;
- const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index);
- ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
mutable_uninterpreted_option();
+ const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
+ ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
uninterpreted_option() const;
@@ -3519,9 +3576,13 @@ class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message /*
// implements Message ----------------------------------------------
- inline MessageOptions* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline MessageOptions* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<MessageOptions>(NULL);
+ }
- MessageOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ MessageOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<MessageOptions>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const MessageOptions& from);
@@ -3566,11 +3627,11 @@ class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message /*
int uninterpreted_option_size() const;
void clear_uninterpreted_option();
static const int kUninterpretedOptionFieldNumber = 999;
- const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index);
- ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
mutable_uninterpreted_option();
+ const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
+ ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
uninterpreted_option() const;
@@ -3690,9 +3751,13 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message /* @@
// implements Message ----------------------------------------------
- inline FieldOptions* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline FieldOptions* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<FieldOptions>(NULL);
+ }
- FieldOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ FieldOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<FieldOptions>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const FieldOptions& from);
@@ -3793,11 +3858,11 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message /* @@
int uninterpreted_option_size() const;
void clear_uninterpreted_option();
static const int kUninterpretedOptionFieldNumber = 999;
- const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index);
- ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
mutable_uninterpreted_option();
+ const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
+ ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
uninterpreted_option() const;
@@ -3937,9 +4002,13 @@ class LIBPROTOBUF_EXPORT OneofOptions : public ::google::protobuf::Message /* @@
// implements Message ----------------------------------------------
- inline OneofOptions* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline OneofOptions* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<OneofOptions>(NULL);
+ }
- OneofOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ OneofOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<OneofOptions>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const OneofOptions& from);
@@ -3984,11 +4053,11 @@ class LIBPROTOBUF_EXPORT OneofOptions : public ::google::protobuf::Message /* @@
int uninterpreted_option_size() const;
void clear_uninterpreted_option();
static const int kUninterpretedOptionFieldNumber = 999;
- const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index);
- ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
mutable_uninterpreted_option();
+ const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
+ ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
uninterpreted_option() const;
@@ -4068,9 +4137,13 @@ class LIBPROTOBUF_EXPORT EnumOptions : public ::google::protobuf::Message /* @@p
// implements Message ----------------------------------------------
- inline EnumOptions* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline EnumOptions* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<EnumOptions>(NULL);
+ }
- EnumOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ EnumOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<EnumOptions>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const EnumOptions& from);
@@ -4115,11 +4188,11 @@ class LIBPROTOBUF_EXPORT EnumOptions : public ::google::protobuf::Message /* @@p
int uninterpreted_option_size() const;
void clear_uninterpreted_option();
static const int kUninterpretedOptionFieldNumber = 999;
- const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index);
- ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
mutable_uninterpreted_option();
+ const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
+ ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
uninterpreted_option() const;
@@ -4219,9 +4292,13 @@ class LIBPROTOBUF_EXPORT EnumValueOptions : public ::google::protobuf::Message /
// implements Message ----------------------------------------------
- inline EnumValueOptions* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline EnumValueOptions* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<EnumValueOptions>(NULL);
+ }
- EnumValueOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ EnumValueOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<EnumValueOptions>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const EnumValueOptions& from);
@@ -4266,11 +4343,11 @@ class LIBPROTOBUF_EXPORT EnumValueOptions : public ::google::protobuf::Message /
int uninterpreted_option_size() const;
void clear_uninterpreted_option();
static const int kUninterpretedOptionFieldNumber = 999;
- const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index);
- ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
mutable_uninterpreted_option();
+ const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
+ ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
uninterpreted_option() const;
@@ -4360,9 +4437,13 @@ class LIBPROTOBUF_EXPORT ServiceOptions : public ::google::protobuf::Message /*
// implements Message ----------------------------------------------
- inline ServiceOptions* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline ServiceOptions* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<ServiceOptions>(NULL);
+ }
- ServiceOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ ServiceOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<ServiceOptions>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const ServiceOptions& from);
@@ -4407,11 +4488,11 @@ class LIBPROTOBUF_EXPORT ServiceOptions : public ::google::protobuf::Message /*
int uninterpreted_option_size() const;
void clear_uninterpreted_option();
static const int kUninterpretedOptionFieldNumber = 999;
- const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index);
- ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
mutable_uninterpreted_option();
+ const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
+ ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
uninterpreted_option() const;
@@ -4501,9 +4582,13 @@ class LIBPROTOBUF_EXPORT MethodOptions : public ::google::protobuf::Message /* @
// implements Message ----------------------------------------------
- inline MethodOptions* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline MethodOptions* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<MethodOptions>(NULL);
+ }
- MethodOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ MethodOptions* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<MethodOptions>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const MethodOptions& from);
@@ -4576,11 +4661,11 @@ class LIBPROTOBUF_EXPORT MethodOptions : public ::google::protobuf::Message /* @
int uninterpreted_option_size() const;
void clear_uninterpreted_option();
static const int kUninterpretedOptionFieldNumber = 999;
- const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
::google::protobuf::UninterpretedOption* mutable_uninterpreted_option(int index);
- ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
mutable_uninterpreted_option();
+ const ::google::protobuf::UninterpretedOption& uninterpreted_option(int index) const;
+ ::google::protobuf::UninterpretedOption* add_uninterpreted_option();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
uninterpreted_option() const;
@@ -4680,9 +4765,13 @@ class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobu
// implements Message ----------------------------------------------
- inline UninterpretedOption_NamePart* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline UninterpretedOption_NamePart* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<UninterpretedOption_NamePart>(NULL);
+ }
- UninterpretedOption_NamePart* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ UninterpretedOption_NamePart* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<UninterpretedOption_NamePart>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const UninterpretedOption_NamePart& from);
@@ -4835,9 +4924,13 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag
// implements Message ----------------------------------------------
- inline UninterpretedOption* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline UninterpretedOption* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<UninterpretedOption>(NULL);
+ }
- UninterpretedOption* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ UninterpretedOption* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<UninterpretedOption>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const UninterpretedOption& from);
@@ -4884,11 +4977,11 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag
int name_size() const;
void clear_name();
static const int kNameFieldNumber = 2;
- const ::google::protobuf::UninterpretedOption_NamePart& name(int index) const;
::google::protobuf::UninterpretedOption_NamePart* mutable_name(int index);
- ::google::protobuf::UninterpretedOption_NamePart* add_name();
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >*
mutable_name();
+ const ::google::protobuf::UninterpretedOption_NamePart& name(int index) const;
+ ::google::protobuf::UninterpretedOption_NamePart* add_name();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >&
name() const;
@@ -5076,9 +5169,13 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo_Location : public ::google::protobuf::Me
// implements Message ----------------------------------------------
- inline SourceCodeInfo_Location* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline SourceCodeInfo_Location* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<SourceCodeInfo_Location>(NULL);
+ }
- SourceCodeInfo_Location* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ SourceCodeInfo_Location* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<SourceCodeInfo_Location>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const SourceCodeInfo_Location& from);
@@ -5296,9 +5393,13 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo : public ::google::protobuf::Message /*
// implements Message ----------------------------------------------
- inline SourceCodeInfo* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline SourceCodeInfo* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<SourceCodeInfo>(NULL);
+ }
- SourceCodeInfo* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ SourceCodeInfo* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<SourceCodeInfo>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const SourceCodeInfo& from);
@@ -5345,11 +5446,11 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo : public ::google::protobuf::Message /*
int location_size() const;
void clear_location();
static const int kLocationFieldNumber = 1;
- const ::google::protobuf::SourceCodeInfo_Location& location(int index) const;
::google::protobuf::SourceCodeInfo_Location* mutable_location(int index);
- ::google::protobuf::SourceCodeInfo_Location* add_location();
::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >*
mutable_location();
+ const ::google::protobuf::SourceCodeInfo_Location& location(int index) const;
+ ::google::protobuf::SourceCodeInfo_Location* add_location();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >&
location() const;
@@ -5426,9 +5527,13 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo_Annotation : public ::google::protobu
// implements Message ----------------------------------------------
- inline GeneratedCodeInfo_Annotation* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline GeneratedCodeInfo_Annotation* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<GeneratedCodeInfo_Annotation>(NULL);
+ }
- GeneratedCodeInfo_Annotation* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ GeneratedCodeInfo_Annotation* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<GeneratedCodeInfo_Annotation>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const GeneratedCodeInfo_Annotation& from);
@@ -5602,9 +5707,13 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo : public ::google::protobuf::Message
// implements Message ----------------------------------------------
- inline GeneratedCodeInfo* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline GeneratedCodeInfo* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<GeneratedCodeInfo>(NULL);
+ }
- GeneratedCodeInfo* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ GeneratedCodeInfo* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<GeneratedCodeInfo>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const GeneratedCodeInfo& from);
@@ -5651,11 +5760,11 @@ class LIBPROTOBUF_EXPORT GeneratedCodeInfo : public ::google::protobuf::Message
int annotation_size() const;
void clear_annotation();
static const int kAnnotationFieldNumber = 1;
- const ::google::protobuf::GeneratedCodeInfo_Annotation& annotation(int index) const;
::google::protobuf::GeneratedCodeInfo_Annotation* mutable_annotation(int index);
- ::google::protobuf::GeneratedCodeInfo_Annotation* add_annotation();
::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >*
mutable_annotation();
+ const ::google::protobuf::GeneratedCodeInfo_Annotation& annotation(int index) const;
+ ::google::protobuf::GeneratedCodeInfo_Annotation* add_annotation();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >&
annotation() const;
@@ -5690,23 +5799,23 @@ inline int FileDescriptorSet::file_size() const {
inline void FileDescriptorSet::clear_file() {
file_.Clear();
}
-inline const ::google::protobuf::FileDescriptorProto& FileDescriptorSet::file(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorSet.file)
- return file_.Get(index);
-}
inline ::google::protobuf::FileDescriptorProto* FileDescriptorSet::mutable_file(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorSet.file)
return file_.Mutable(index);
}
-inline ::google::protobuf::FileDescriptorProto* FileDescriptorSet::add_file() {
- // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorSet.file)
- return file_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >*
FileDescriptorSet::mutable_file() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorSet.file)
return &file_;
}
+inline const ::google::protobuf::FileDescriptorProto& FileDescriptorSet::file(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorSet.file)
+ return file_.Get(index);
+}
+inline ::google::protobuf::FileDescriptorProto* FileDescriptorSet::add_file() {
+ // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorSet.file)
+ return file_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto >&
FileDescriptorSet::file() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorSet.file)
@@ -6023,23 +6132,23 @@ inline int FileDescriptorProto::message_type_size() const {
inline void FileDescriptorProto::clear_message_type() {
message_type_.Clear();
}
-inline const ::google::protobuf::DescriptorProto& FileDescriptorProto::message_type(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.message_type)
- return message_type_.Get(index);
-}
inline ::google::protobuf::DescriptorProto* FileDescriptorProto::mutable_message_type(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.message_type)
return message_type_.Mutable(index);
}
-inline ::google::protobuf::DescriptorProto* FileDescriptorProto::add_message_type() {
- // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.message_type)
- return message_type_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >*
FileDescriptorProto::mutable_message_type() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.message_type)
return &message_type_;
}
+inline const ::google::protobuf::DescriptorProto& FileDescriptorProto::message_type(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.message_type)
+ return message_type_.Get(index);
+}
+inline ::google::protobuf::DescriptorProto* FileDescriptorProto::add_message_type() {
+ // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.message_type)
+ return message_type_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >&
FileDescriptorProto::message_type() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.message_type)
@@ -6053,23 +6162,23 @@ inline int FileDescriptorProto::enum_type_size() const {
inline void FileDescriptorProto::clear_enum_type() {
enum_type_.Clear();
}
-inline const ::google::protobuf::EnumDescriptorProto& FileDescriptorProto::enum_type(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.enum_type)
- return enum_type_.Get(index);
-}
inline ::google::protobuf::EnumDescriptorProto* FileDescriptorProto::mutable_enum_type(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.enum_type)
return enum_type_.Mutable(index);
}
-inline ::google::protobuf::EnumDescriptorProto* FileDescriptorProto::add_enum_type() {
- // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.enum_type)
- return enum_type_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >*
FileDescriptorProto::mutable_enum_type() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.enum_type)
return &enum_type_;
}
+inline const ::google::protobuf::EnumDescriptorProto& FileDescriptorProto::enum_type(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.enum_type)
+ return enum_type_.Get(index);
+}
+inline ::google::protobuf::EnumDescriptorProto* FileDescriptorProto::add_enum_type() {
+ // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.enum_type)
+ return enum_type_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >&
FileDescriptorProto::enum_type() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.enum_type)
@@ -6083,23 +6192,23 @@ inline int FileDescriptorProto::service_size() const {
inline void FileDescriptorProto::clear_service() {
service_.Clear();
}
-inline const ::google::protobuf::ServiceDescriptorProto& FileDescriptorProto::service(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.service)
- return service_.Get(index);
-}
inline ::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::mutable_service(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.service)
return service_.Mutable(index);
}
-inline ::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::add_service() {
- // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.service)
- return service_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >*
FileDescriptorProto::mutable_service() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.service)
return &service_;
}
+inline const ::google::protobuf::ServiceDescriptorProto& FileDescriptorProto::service(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.service)
+ return service_.Get(index);
+}
+inline ::google::protobuf::ServiceDescriptorProto* FileDescriptorProto::add_service() {
+ // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.service)
+ return service_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto >&
FileDescriptorProto::service() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.service)
@@ -6113,23 +6222,23 @@ inline int FileDescriptorProto::extension_size() const {
inline void FileDescriptorProto::clear_extension() {
extension_.Clear();
}
-inline const ::google::protobuf::FieldDescriptorProto& FileDescriptorProto::extension(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.extension)
- return extension_.Get(index);
-}
inline ::google::protobuf::FieldDescriptorProto* FileDescriptorProto::mutable_extension(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.extension)
return extension_.Mutable(index);
}
-inline ::google::protobuf::FieldDescriptorProto* FileDescriptorProto::add_extension() {
- // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.extension)
- return extension_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >*
FileDescriptorProto::mutable_extension() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.extension)
return &extension_;
}
+inline const ::google::protobuf::FieldDescriptorProto& FileDescriptorProto::extension(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.extension)
+ return extension_.Get(index);
+}
+inline ::google::protobuf::FieldDescriptorProto* FileDescriptorProto::add_extension() {
+ // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.extension)
+ return extension_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >&
FileDescriptorProto::extension() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.extension)
@@ -6176,7 +6285,8 @@ inline ::google::protobuf::FileOptions* FileDescriptorProto::unsafe_arena_releas
inline ::google::protobuf::FileOptions* FileDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- _slow_mutable_options();
+ options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::FileOptions >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.options)
return options_;
@@ -6241,7 +6351,8 @@ inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::unsafe_arena_rel
inline ::google::protobuf::SourceCodeInfo* FileDescriptorProto::mutable_source_code_info() {
set_has_source_code_info();
if (source_code_info_ == NULL) {
- _slow_mutable_source_code_info();
+ source_code_info_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::SourceCodeInfo >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.source_code_info)
return source_code_info_;
@@ -6443,7 +6554,8 @@ inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange
inline ::google::protobuf::ExtensionRangeOptions* DescriptorProto_ExtensionRange::mutable_options() {
set_has_options();
if (options_ == NULL) {
- _slow_mutable_options();
+ options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ExtensionRangeOptions >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.ExtensionRange.options)
return options_;
@@ -6616,23 +6728,23 @@ inline int DescriptorProto::field_size() const {
inline void DescriptorProto::clear_field() {
field_.Clear();
}
-inline const ::google::protobuf::FieldDescriptorProto& DescriptorProto::field(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.field)
- return field_.Get(index);
-}
inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::mutable_field(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.field)
return field_.Mutable(index);
}
-inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::add_field() {
- // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.field)
- return field_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >*
DescriptorProto::mutable_field() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.field)
return &field_;
}
+inline const ::google::protobuf::FieldDescriptorProto& DescriptorProto::field(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.field)
+ return field_.Get(index);
+}
+inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::add_field() {
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.field)
+ return field_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >&
DescriptorProto::field() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.field)
@@ -6646,23 +6758,23 @@ inline int DescriptorProto::extension_size() const {
inline void DescriptorProto::clear_extension() {
extension_.Clear();
}
-inline const ::google::protobuf::FieldDescriptorProto& DescriptorProto::extension(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension)
- return extension_.Get(index);
-}
inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::mutable_extension(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.extension)
return extension_.Mutable(index);
}
-inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::add_extension() {
- // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension)
- return extension_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >*
DescriptorProto::mutable_extension() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension)
return &extension_;
}
+inline const ::google::protobuf::FieldDescriptorProto& DescriptorProto::extension(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension)
+ return extension_.Get(index);
+}
+inline ::google::protobuf::FieldDescriptorProto* DescriptorProto::add_extension() {
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension)
+ return extension_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto >&
DescriptorProto::extension() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.extension)
@@ -6676,23 +6788,23 @@ inline int DescriptorProto::nested_type_size() const {
inline void DescriptorProto::clear_nested_type() {
nested_type_.Clear();
}
-inline const ::google::protobuf::DescriptorProto& DescriptorProto::nested_type(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.nested_type)
- return nested_type_.Get(index);
-}
inline ::google::protobuf::DescriptorProto* DescriptorProto::mutable_nested_type(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.nested_type)
return nested_type_.Mutable(index);
}
-inline ::google::protobuf::DescriptorProto* DescriptorProto::add_nested_type() {
- // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.nested_type)
- return nested_type_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >*
DescriptorProto::mutable_nested_type() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.nested_type)
return &nested_type_;
}
+inline const ::google::protobuf::DescriptorProto& DescriptorProto::nested_type(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.nested_type)
+ return nested_type_.Get(index);
+}
+inline ::google::protobuf::DescriptorProto* DescriptorProto::add_nested_type() {
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.nested_type)
+ return nested_type_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto >&
DescriptorProto::nested_type() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.nested_type)
@@ -6706,23 +6818,23 @@ inline int DescriptorProto::enum_type_size() const {
inline void DescriptorProto::clear_enum_type() {
enum_type_.Clear();
}
-inline const ::google::protobuf::EnumDescriptorProto& DescriptorProto::enum_type(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.enum_type)
- return enum_type_.Get(index);
-}
inline ::google::protobuf::EnumDescriptorProto* DescriptorProto::mutable_enum_type(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.enum_type)
return enum_type_.Mutable(index);
}
-inline ::google::protobuf::EnumDescriptorProto* DescriptorProto::add_enum_type() {
- // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.enum_type)
- return enum_type_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >*
DescriptorProto::mutable_enum_type() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.enum_type)
return &enum_type_;
}
+inline const ::google::protobuf::EnumDescriptorProto& DescriptorProto::enum_type(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.enum_type)
+ return enum_type_.Get(index);
+}
+inline ::google::protobuf::EnumDescriptorProto* DescriptorProto::add_enum_type() {
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.enum_type)
+ return enum_type_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto >&
DescriptorProto::enum_type() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.enum_type)
@@ -6736,23 +6848,23 @@ inline int DescriptorProto::extension_range_size() const {
inline void DescriptorProto::clear_extension_range() {
extension_range_.Clear();
}
-inline const ::google::protobuf::DescriptorProto_ExtensionRange& DescriptorProto::extension_range(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension_range)
- return extension_range_.Get(index);
-}
inline ::google::protobuf::DescriptorProto_ExtensionRange* DescriptorProto::mutable_extension_range(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.extension_range)
return extension_range_.Mutable(index);
}
-inline ::google::protobuf::DescriptorProto_ExtensionRange* DescriptorProto::add_extension_range() {
- // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension_range)
- return extension_range_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >*
DescriptorProto::mutable_extension_range() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.extension_range)
return &extension_range_;
}
+inline const ::google::protobuf::DescriptorProto_ExtensionRange& DescriptorProto::extension_range(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.extension_range)
+ return extension_range_.Get(index);
+}
+inline ::google::protobuf::DescriptorProto_ExtensionRange* DescriptorProto::add_extension_range() {
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.extension_range)
+ return extension_range_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange >&
DescriptorProto::extension_range() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.extension_range)
@@ -6766,23 +6878,23 @@ inline int DescriptorProto::oneof_decl_size() const {
inline void DescriptorProto::clear_oneof_decl() {
oneof_decl_.Clear();
}
-inline const ::google::protobuf::OneofDescriptorProto& DescriptorProto::oneof_decl(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.oneof_decl)
- return oneof_decl_.Get(index);
-}
inline ::google::protobuf::OneofDescriptorProto* DescriptorProto::mutable_oneof_decl(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.oneof_decl)
return oneof_decl_.Mutable(index);
}
-inline ::google::protobuf::OneofDescriptorProto* DescriptorProto::add_oneof_decl() {
- // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.oneof_decl)
- return oneof_decl_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto >*
DescriptorProto::mutable_oneof_decl() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.oneof_decl)
return &oneof_decl_;
}
+inline const ::google::protobuf::OneofDescriptorProto& DescriptorProto::oneof_decl(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.oneof_decl)
+ return oneof_decl_.Get(index);
+}
+inline ::google::protobuf::OneofDescriptorProto* DescriptorProto::add_oneof_decl() {
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.oneof_decl)
+ return oneof_decl_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::OneofDescriptorProto >&
DescriptorProto::oneof_decl() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.oneof_decl)
@@ -6829,7 +6941,8 @@ inline ::google::protobuf::MessageOptions* DescriptorProto::unsafe_arena_release
inline ::google::protobuf::MessageOptions* DescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- _slow_mutable_options();
+ options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::MessageOptions >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.options)
return options_;
@@ -6861,23 +6974,23 @@ inline int DescriptorProto::reserved_range_size() const {
inline void DescriptorProto::clear_reserved_range() {
reserved_range_.Clear();
}
-inline const ::google::protobuf::DescriptorProto_ReservedRange& DescriptorProto::reserved_range(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.reserved_range)
- return reserved_range_.Get(index);
-}
inline ::google::protobuf::DescriptorProto_ReservedRange* DescriptorProto::mutable_reserved_range(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.reserved_range)
return reserved_range_.Mutable(index);
}
-inline ::google::protobuf::DescriptorProto_ReservedRange* DescriptorProto::add_reserved_range() {
- // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_range)
- return reserved_range_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ReservedRange >*
DescriptorProto::mutable_reserved_range() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.DescriptorProto.reserved_range)
return &reserved_range_;
}
+inline const ::google::protobuf::DescriptorProto_ReservedRange& DescriptorProto::reserved_range(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.reserved_range)
+ return reserved_range_.Get(index);
+}
+inline ::google::protobuf::DescriptorProto_ReservedRange* DescriptorProto::add_reserved_range() {
+ // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_range)
+ return reserved_range_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ReservedRange >&
DescriptorProto::reserved_range() const {
// @@protoc_insertion_point(field_list:google.protobuf.DescriptorProto.reserved_range)
@@ -6964,23 +7077,23 @@ inline int ExtensionRangeOptions::uninterpreted_option_size() const {
inline void ExtensionRangeOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
-inline const ::google::protobuf::UninterpretedOption& ExtensionRangeOptions::uninterpreted_option(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.ExtensionRangeOptions.uninterpreted_option)
- return uninterpreted_option_.Get(index);
-}
inline ::google::protobuf::UninterpretedOption* ExtensionRangeOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.ExtensionRangeOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
-inline ::google::protobuf::UninterpretedOption* ExtensionRangeOptions::add_uninterpreted_option() {
- // @@protoc_insertion_point(field_add:google.protobuf.ExtensionRangeOptions.uninterpreted_option)
- return uninterpreted_option_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
ExtensionRangeOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.ExtensionRangeOptions.uninterpreted_option)
return &uninterpreted_option_;
}
+inline const ::google::protobuf::UninterpretedOption& ExtensionRangeOptions::uninterpreted_option(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.ExtensionRangeOptions.uninterpreted_option)
+ return uninterpreted_option_.Get(index);
+}
+inline ::google::protobuf::UninterpretedOption* ExtensionRangeOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.ExtensionRangeOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
ExtensionRangeOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.ExtensionRangeOptions.uninterpreted_option)
@@ -7554,7 +7667,8 @@ inline ::google::protobuf::FieldOptions* FieldDescriptorProto::unsafe_arena_rele
inline ::google::protobuf::FieldOptions* FieldDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- _slow_mutable_options();
+ options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::FieldOptions >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldDescriptorProto.options)
return options_;
@@ -7708,7 +7822,8 @@ inline ::google::protobuf::OneofOptions* OneofDescriptorProto::unsafe_arena_rele
inline ::google::protobuf::OneofOptions* OneofDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- _slow_mutable_options();
+ options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::OneofOptions >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.OneofDescriptorProto.options)
return options_;
@@ -7881,23 +7996,23 @@ inline int EnumDescriptorProto::value_size() const {
inline void EnumDescriptorProto::clear_value() {
value_.Clear();
}
-inline const ::google::protobuf::EnumValueDescriptorProto& EnumDescriptorProto::value(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.value)
- return value_.Get(index);
-}
inline ::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::mutable_value(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.value)
return value_.Mutable(index);
}
-inline ::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::add_value() {
- // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.value)
- return value_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >*
EnumDescriptorProto::mutable_value() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.value)
return &value_;
}
+inline const ::google::protobuf::EnumValueDescriptorProto& EnumDescriptorProto::value(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.value)
+ return value_.Get(index);
+}
+inline ::google::protobuf::EnumValueDescriptorProto* EnumDescriptorProto::add_value() {
+ // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.value)
+ return value_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto >&
EnumDescriptorProto::value() const {
// @@protoc_insertion_point(field_list:google.protobuf.EnumDescriptorProto.value)
@@ -7944,7 +8059,8 @@ inline ::google::protobuf::EnumOptions* EnumDescriptorProto::unsafe_arena_releas
inline ::google::protobuf::EnumOptions* EnumDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- _slow_mutable_options();
+ options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::EnumOptions >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.options)
return options_;
@@ -7976,23 +8092,23 @@ inline int EnumDescriptorProto::reserved_range_size() const {
inline void EnumDescriptorProto::clear_reserved_range() {
reserved_range_.Clear();
}
-inline const ::google::protobuf::EnumDescriptorProto_EnumReservedRange& EnumDescriptorProto::reserved_range(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.reserved_range)
- return reserved_range_.Get(index);
-}
inline ::google::protobuf::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::mutable_reserved_range(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumDescriptorProto.reserved_range)
return reserved_range_.Mutable(index);
}
-inline ::google::protobuf::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::add_reserved_range() {
- // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.reserved_range)
- return reserved_range_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto_EnumReservedRange >*
EnumDescriptorProto::mutable_reserved_range() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumDescriptorProto.reserved_range)
return &reserved_range_;
}
+inline const ::google::protobuf::EnumDescriptorProto_EnumReservedRange& EnumDescriptorProto::reserved_range(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.reserved_range)
+ return reserved_range_.Get(index);
+}
+inline ::google::protobuf::EnumDescriptorProto_EnumReservedRange* EnumDescriptorProto::add_reserved_range() {
+ // @@protoc_insertion_point(field_add:google.protobuf.EnumDescriptorProto.reserved_range)
+ return reserved_range_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto_EnumReservedRange >&
EnumDescriptorProto::reserved_range() const {
// @@protoc_insertion_point(field_list:google.protobuf.EnumDescriptorProto.reserved_range)
@@ -8221,7 +8337,8 @@ inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::unsafe_ar
inline ::google::protobuf::EnumValueOptions* EnumValueDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- _slow_mutable_options();
+ options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::EnumValueOptions >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueDescriptorProto.options)
return options_;
@@ -8342,23 +8459,23 @@ inline int ServiceDescriptorProto::method_size() const {
inline void ServiceDescriptorProto::clear_method() {
method_.Clear();
}
-inline const ::google::protobuf::MethodDescriptorProto& ServiceDescriptorProto::method(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.method)
- return method_.Get(index);
-}
inline ::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::mutable_method(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.method)
return method_.Mutable(index);
}
-inline ::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::add_method() {
- // @@protoc_insertion_point(field_add:google.protobuf.ServiceDescriptorProto.method)
- return method_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >*
ServiceDescriptorProto::mutable_method() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceDescriptorProto.method)
return &method_;
}
+inline const ::google::protobuf::MethodDescriptorProto& ServiceDescriptorProto::method(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.method)
+ return method_.Get(index);
+}
+inline ::google::protobuf::MethodDescriptorProto* ServiceDescriptorProto::add_method() {
+ // @@protoc_insertion_point(field_add:google.protobuf.ServiceDescriptorProto.method)
+ return method_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto >&
ServiceDescriptorProto::method() const {
// @@protoc_insertion_point(field_list:google.protobuf.ServiceDescriptorProto.method)
@@ -8405,7 +8522,8 @@ inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::unsafe_arena_
inline ::google::protobuf::ServiceOptions* ServiceDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- _slow_mutable_options();
+ options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ServiceOptions >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.ServiceDescriptorProto.options)
return options_;
@@ -8729,7 +8847,8 @@ inline ::google::protobuf::MethodOptions* MethodDescriptorProto::unsafe_arena_re
inline ::google::protobuf::MethodOptions* MethodDescriptorProto::mutable_options() {
set_has_options();
if (options_ == NULL) {
- _slow_mutable_options();
+ options_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::MethodOptions >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.MethodDescriptorProto.options)
return options_;
@@ -9734,23 +9853,23 @@ inline int FileOptions::uninterpreted_option_size() const {
inline void FileOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
-inline const ::google::protobuf::UninterpretedOption& FileOptions::uninterpreted_option(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.uninterpreted_option)
- return uninterpreted_option_.Get(index);
-}
inline ::google::protobuf::UninterpretedOption* FileOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
-inline ::google::protobuf::UninterpretedOption* FileOptions::add_uninterpreted_option() {
- // @@protoc_insertion_point(field_add:google.protobuf.FileOptions.uninterpreted_option)
- return uninterpreted_option_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
FileOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FileOptions.uninterpreted_option)
return &uninterpreted_option_;
}
+inline const ::google::protobuf::UninterpretedOption& FileOptions::uninterpreted_option(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.uninterpreted_option)
+ return uninterpreted_option_.Get(index);
+}
+inline ::google::protobuf::UninterpretedOption* FileOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.FileOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
FileOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.FileOptions.uninterpreted_option)
@@ -9864,23 +9983,23 @@ inline int MessageOptions::uninterpreted_option_size() const {
inline void MessageOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
-inline const ::google::protobuf::UninterpretedOption& MessageOptions::uninterpreted_option(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.uninterpreted_option)
- return uninterpreted_option_.Get(index);
-}
inline ::google::protobuf::UninterpretedOption* MessageOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.MessageOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
-inline ::google::protobuf::UninterpretedOption* MessageOptions::add_uninterpreted_option() {
- // @@protoc_insertion_point(field_add:google.protobuf.MessageOptions.uninterpreted_option)
- return uninterpreted_option_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
MessageOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.MessageOptions.uninterpreted_option)
return &uninterpreted_option_;
}
+inline const ::google::protobuf::UninterpretedOption& MessageOptions::uninterpreted_option(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.MessageOptions.uninterpreted_option)
+ return uninterpreted_option_.Get(index);
+}
+inline ::google::protobuf::UninterpretedOption* MessageOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.MessageOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
MessageOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.MessageOptions.uninterpreted_option)
@@ -10044,23 +10163,23 @@ inline int FieldOptions::uninterpreted_option_size() const {
inline void FieldOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
-inline const ::google::protobuf::UninterpretedOption& FieldOptions::uninterpreted_option(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.uninterpreted_option)
- return uninterpreted_option_.Get(index);
-}
inline ::google::protobuf::UninterpretedOption* FieldOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.FieldOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
-inline ::google::protobuf::UninterpretedOption* FieldOptions::add_uninterpreted_option() {
- // @@protoc_insertion_point(field_add:google.protobuf.FieldOptions.uninterpreted_option)
- return uninterpreted_option_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
FieldOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldOptions.uninterpreted_option)
return &uninterpreted_option_;
}
+inline const ::google::protobuf::UninterpretedOption& FieldOptions::uninterpreted_option(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.FieldOptions.uninterpreted_option)
+ return uninterpreted_option_.Get(index);
+}
+inline ::google::protobuf::UninterpretedOption* FieldOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.FieldOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
FieldOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.FieldOptions.uninterpreted_option)
@@ -10078,23 +10197,23 @@ inline int OneofOptions::uninterpreted_option_size() const {
inline void OneofOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
-inline const ::google::protobuf::UninterpretedOption& OneofOptions::uninterpreted_option(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.OneofOptions.uninterpreted_option)
- return uninterpreted_option_.Get(index);
-}
inline ::google::protobuf::UninterpretedOption* OneofOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.OneofOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
-inline ::google::protobuf::UninterpretedOption* OneofOptions::add_uninterpreted_option() {
- // @@protoc_insertion_point(field_add:google.protobuf.OneofOptions.uninterpreted_option)
- return uninterpreted_option_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
OneofOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.OneofOptions.uninterpreted_option)
return &uninterpreted_option_;
}
+inline const ::google::protobuf::UninterpretedOption& OneofOptions::uninterpreted_option(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.OneofOptions.uninterpreted_option)
+ return uninterpreted_option_.Get(index);
+}
+inline ::google::protobuf::UninterpretedOption* OneofOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.OneofOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
OneofOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.OneofOptions.uninterpreted_option)
@@ -10160,23 +10279,23 @@ inline int EnumOptions::uninterpreted_option_size() const {
inline void EnumOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
-inline const ::google::protobuf::UninterpretedOption& EnumOptions::uninterpreted_option(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.uninterpreted_option)
- return uninterpreted_option_.Get(index);
-}
inline ::google::protobuf::UninterpretedOption* EnumOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
-inline ::google::protobuf::UninterpretedOption* EnumOptions::add_uninterpreted_option() {
- // @@protoc_insertion_point(field_add:google.protobuf.EnumOptions.uninterpreted_option)
- return uninterpreted_option_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
EnumOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumOptions.uninterpreted_option)
return &uninterpreted_option_;
}
+inline const ::google::protobuf::UninterpretedOption& EnumOptions::uninterpreted_option(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumOptions.uninterpreted_option)
+ return uninterpreted_option_.Get(index);
+}
+inline ::google::protobuf::UninterpretedOption* EnumOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.EnumOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
EnumOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.EnumOptions.uninterpreted_option)
@@ -10218,23 +10337,23 @@ inline int EnumValueOptions::uninterpreted_option_size() const {
inline void EnumValueOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
-inline const ::google::protobuf::UninterpretedOption& EnumValueOptions::uninterpreted_option(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.uninterpreted_option)
- return uninterpreted_option_.Get(index);
-}
inline ::google::protobuf::UninterpretedOption* EnumValueOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumValueOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
-inline ::google::protobuf::UninterpretedOption* EnumValueOptions::add_uninterpreted_option() {
- // @@protoc_insertion_point(field_add:google.protobuf.EnumValueOptions.uninterpreted_option)
- return uninterpreted_option_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
EnumValueOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValueOptions.uninterpreted_option)
return &uninterpreted_option_;
}
+inline const ::google::protobuf::UninterpretedOption& EnumValueOptions::uninterpreted_option(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumValueOptions.uninterpreted_option)
+ return uninterpreted_option_.Get(index);
+}
+inline ::google::protobuf::UninterpretedOption* EnumValueOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.EnumValueOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
EnumValueOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.EnumValueOptions.uninterpreted_option)
@@ -10276,23 +10395,23 @@ inline int ServiceOptions::uninterpreted_option_size() const {
inline void ServiceOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
-inline const ::google::protobuf::UninterpretedOption& ServiceOptions::uninterpreted_option(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.ServiceOptions.uninterpreted_option)
- return uninterpreted_option_.Get(index);
-}
inline ::google::protobuf::UninterpretedOption* ServiceOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.ServiceOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
-inline ::google::protobuf::UninterpretedOption* ServiceOptions::add_uninterpreted_option() {
- // @@protoc_insertion_point(field_add:google.protobuf.ServiceOptions.uninterpreted_option)
- return uninterpreted_option_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
ServiceOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.ServiceOptions.uninterpreted_option)
return &uninterpreted_option_;
}
+inline const ::google::protobuf::UninterpretedOption& ServiceOptions::uninterpreted_option(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.ServiceOptions.uninterpreted_option)
+ return uninterpreted_option_.Get(index);
+}
+inline ::google::protobuf::UninterpretedOption* ServiceOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.ServiceOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
ServiceOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.ServiceOptions.uninterpreted_option)
@@ -10359,23 +10478,23 @@ inline int MethodOptions::uninterpreted_option_size() const {
inline void MethodOptions::clear_uninterpreted_option() {
uninterpreted_option_.Clear();
}
-inline const ::google::protobuf::UninterpretedOption& MethodOptions::uninterpreted_option(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.uninterpreted_option)
- return uninterpreted_option_.Get(index);
-}
inline ::google::protobuf::UninterpretedOption* MethodOptions::mutable_uninterpreted_option(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.MethodOptions.uninterpreted_option)
return uninterpreted_option_.Mutable(index);
}
-inline ::google::protobuf::UninterpretedOption* MethodOptions::add_uninterpreted_option() {
- // @@protoc_insertion_point(field_add:google.protobuf.MethodOptions.uninterpreted_option)
- return uninterpreted_option_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >*
MethodOptions::mutable_uninterpreted_option() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.MethodOptions.uninterpreted_option)
return &uninterpreted_option_;
}
+inline const ::google::protobuf::UninterpretedOption& MethodOptions::uninterpreted_option(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.MethodOptions.uninterpreted_option)
+ return uninterpreted_option_.Get(index);
+}
+inline ::google::protobuf::UninterpretedOption* MethodOptions::add_uninterpreted_option() {
+ // @@protoc_insertion_point(field_add:google.protobuf.MethodOptions.uninterpreted_option)
+ return uninterpreted_option_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption >&
MethodOptions::uninterpreted_option() const {
// @@protoc_insertion_point(field_list:google.protobuf.MethodOptions.uninterpreted_option)
@@ -10506,23 +10625,23 @@ inline int UninterpretedOption::name_size() const {
inline void UninterpretedOption::clear_name() {
name_.Clear();
}
-inline const ::google::protobuf::UninterpretedOption_NamePart& UninterpretedOption::name(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.name)
- return name_.Get(index);
-}
inline ::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::mutable_name(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.UninterpretedOption.name)
return name_.Mutable(index);
}
-inline ::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::add_name() {
- // @@protoc_insertion_point(field_add:google.protobuf.UninterpretedOption.name)
- return name_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >*
UninterpretedOption::mutable_name() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.UninterpretedOption.name)
return &name_;
}
+inline const ::google::protobuf::UninterpretedOption_NamePart& UninterpretedOption::name(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.name)
+ return name_.Get(index);
+}
+inline ::google::protobuf::UninterpretedOption_NamePart* UninterpretedOption::add_name() {
+ // @@protoc_insertion_point(field_add:google.protobuf.UninterpretedOption.name)
+ return name_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption_NamePart >&
UninterpretedOption::name() const {
// @@protoc_insertion_point(field_list:google.protobuf.UninterpretedOption.name)
@@ -11170,23 +11289,23 @@ inline int SourceCodeInfo::location_size() const {
inline void SourceCodeInfo::clear_location() {
location_.Clear();
}
-inline const ::google::protobuf::SourceCodeInfo_Location& SourceCodeInfo::location(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.location)
- return location_.Get(index);
-}
inline ::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::mutable_location(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.location)
return location_.Mutable(index);
}
-inline ::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::add_location() {
- // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.location)
- return location_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >*
SourceCodeInfo::mutable_location() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.location)
return &location_;
}
+inline const ::google::protobuf::SourceCodeInfo_Location& SourceCodeInfo::location(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.location)
+ return location_.Get(index);
+}
+inline ::google::protobuf::SourceCodeInfo_Location* SourceCodeInfo::add_location() {
+ // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.location)
+ return location_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::SourceCodeInfo_Location >&
SourceCodeInfo::location() const {
// @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.location)
@@ -11371,23 +11490,23 @@ inline int GeneratedCodeInfo::annotation_size() const {
inline void GeneratedCodeInfo::clear_annotation() {
annotation_.Clear();
}
-inline const ::google::protobuf::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::annotation(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.annotation)
- return annotation_.Get(index);
-}
inline ::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::mutable_annotation(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.annotation)
return annotation_.Mutable(index);
}
-inline ::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::add_annotation() {
- // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.annotation)
- return annotation_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >*
GeneratedCodeInfo::mutable_annotation() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.annotation)
return &annotation_;
}
+inline const ::google::protobuf::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::annotation(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.annotation)
+ return annotation_.Get(index);
+}
+inline ::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::add_annotation() {
+ // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.annotation)
+ return annotation_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >&
GeneratedCodeInfo::annotation() const {
// @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.annotation)
@@ -11494,4 +11613,4 @@ inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::MethodOption
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_google_2fprotobuf_2fdescriptor_2eproto__INCLUDED
+#endif // PROTOBUF_google_2fprotobuf_2fdescriptor_2eproto_INCLUDED
diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc
index 6cca0ada..b0337035 100644
--- a/src/google/protobuf/descriptor_unittest.cc
+++ b/src/google/protobuf/descriptor_unittest.cc
@@ -431,6 +431,7 @@ TEST_F(FileDescriptorTest, FindExtensionByNumber) {
EXPECT_TRUE(pool_.FindExtensionByNumber(foo_message_, 2) == NULL);
}
+
TEST_F(FileDescriptorTest, BuildAgain) {
// Test that if te call BuildFile again on the same input we get the same
// FileDescriptor back.
@@ -973,6 +974,7 @@ TEST_F(DescriptorTest, FieldEnumType) {
EXPECT_EQ(enum_, bar_->enum_type());
}
+
// ===================================================================
// Test simple flat messages and fields.
@@ -1943,6 +1945,7 @@ TEST_F(ExtensionDescriptorTest, FindAllExtensions) {
EXPECT_EQ(39, extensions[3]->number());
}
+
TEST_F(ExtensionDescriptorTest, DuplicateFieldNumber) {
DescriptorPool pool;
FileDescriptorProto file_proto;
diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc
index 0a8aad48..b4d5eb5f 100644
--- a/src/google/protobuf/duration.pb.cc
+++ b/src/google/protobuf/duration.pb.cc
@@ -191,9 +191,6 @@ const Duration& Duration::default_instance() {
return *internal_default_instance();
}
-Duration* Duration::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<Duration>(arena);
-}
void Duration::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Duration)
@@ -427,5 +424,12 @@ void Duration::InternalSwap(Duration* other) {
// @@protoc_insertion_point(namespace_scope)
} // namespace protobuf
} // namespace google
+namespace google {
+namespace protobuf {
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Duration* Arena::CreateMessage< ::google::protobuf::Duration >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::Duration >(arena);
+}
+} // namespace protobuf
+} // namespace google
// @@protoc_insertion_point(global_scope)
diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h
index e13328ac..7fe0748d 100644
--- a/src/google/protobuf/duration.pb.h
+++ b/src/google/protobuf/duration.pb.h
@@ -1,8 +1,8 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/duration.proto
-#ifndef PROTOBUF_google_2fprotobuf_2fduration_2eproto__INCLUDED
-#define PROTOBUF_google_2fprotobuf_2fduration_2eproto__INCLUDED
+#ifndef PROTOBUF_google_2fprotobuf_2fduration_2eproto_INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fduration_2eproto_INCLUDED
#include <string>
@@ -57,6 +57,11 @@ LIBPROTOBUF_EXPORT extern DurationDefaultTypeInternal _Duration_default_instance
} // namespace google
namespace google {
namespace protobuf {
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Duration* Arena::CreateMessage< ::google::protobuf::Duration>(Arena*);
+} // namespace protobuf
+} // namespace google
+namespace google {
+namespace protobuf {
// ===================================================================
@@ -111,9 +116,13 @@ class LIBPROTOBUF_EXPORT Duration : public ::google::protobuf::Message /* @@prot
// implements Message ----------------------------------------------
- inline Duration* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Duration* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Duration>(NULL);
+ }
- Duration* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Duration* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Duration>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Duration& from);
@@ -229,4 +238,4 @@ inline void Duration::set_nanos(::google::protobuf::int32 value) {
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_google_2fprotobuf_2fduration_2eproto__INCLUDED
+#endif // PROTOBUF_google_2fprotobuf_2fduration_2eproto_INCLUDED
diff --git a/src/google/protobuf/dynamic_message.cc b/src/google/protobuf/dynamic_message.cc
index cdd43243..48d6aad8 100644
--- a/src/google/protobuf/dynamic_message.cc
+++ b/src/google/protobuf/dynamic_message.cc
@@ -263,7 +263,7 @@ class DynamicMessage : public Message {
Message* New() const;
Message* New(::google::protobuf::Arena* arena) const;
- ::google::protobuf::Arena* GetArena() const { return NULL; };
+ ::google::protobuf::Arena* GetArena() const { return arena_; }
int GetCachedSize() const;
void SetCachedSize(int size) const;
@@ -282,7 +282,6 @@ class DynamicMessage : public Message {
#endif // !_MSC_VER
private:
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DynamicMessage);
DynamicMessage(const TypeInfo* type_info, ::google::protobuf::Arena* arena);
void SharedCtor(bool lock_factory);
@@ -302,25 +301,25 @@ class DynamicMessage : public Message {
}
const TypeInfo* type_info_;
+ Arena* const arena_;
// TODO(kenton): Make this an atomic<int> when C++ supports it.
mutable int cached_byte_size_;
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DynamicMessage);
};
DynamicMessage::DynamicMessage(const TypeInfo* type_info)
- : type_info_(type_info),
- cached_byte_size_(0) {
+ : type_info_(type_info), arena_(NULL), cached_byte_size_(0) {
SharedCtor(true);
}
DynamicMessage::DynamicMessage(const TypeInfo* type_info,
::google::protobuf::Arena* arena)
- : type_info_(type_info),
- cached_byte_size_(0) {
+ : type_info_(type_info), arena_(arena), cached_byte_size_(0) {
SharedCtor(true);
}
DynamicMessage::DynamicMessage(const TypeInfo* type_info, bool lock_factory)
- : type_info_(type_info), cached_byte_size_(0) {
+ : type_info_(type_info), arena_(NULL), cached_byte_size_(0) {
SharedCtor(lock_factory);
}
@@ -342,10 +341,10 @@ void DynamicMessage::SharedCtor(bool lock_factory) {
}
new (OffsetToPointer(type_info_->internal_metadata_offset))
- InternalMetadataWithArena;
+ InternalMetadataWithArena(arena_);
if (type_info_->extensions_offset != -1) {
- new (OffsetToPointer(type_info_->extensions_offset)) ExtensionSet;
+ new (OffsetToPointer(type_info_->extensions_offset)) ExtensionSet(arena_);
}
for (int i = 0; i < descriptor->field_count(); i++) {
const FieldDescriptor* field = descriptor->field(i);
@@ -354,14 +353,14 @@ void DynamicMessage::SharedCtor(bool lock_factory) {
continue;
}
switch (field->cpp_type()) {
-#define HANDLE_TYPE(CPPTYPE, TYPE) \
- case FieldDescriptor::CPPTYPE_##CPPTYPE: \
- if (!field->is_repeated()) { \
- new(field_ptr) TYPE(field->default_value_##TYPE()); \
- } else { \
- new(field_ptr) RepeatedField<TYPE>(); \
- } \
- break;
+#define HANDLE_TYPE(CPPTYPE, TYPE) \
+ case FieldDescriptor::CPPTYPE_##CPPTYPE: \
+ if (!field->is_repeated()) { \
+ new (field_ptr) TYPE(field->default_value_##TYPE()); \
+ } else { \
+ new (field_ptr) RepeatedField<TYPE>(arena_); \
+ } \
+ break;
HANDLE_TYPE(INT32 , int32 );
HANDLE_TYPE(INT64 , int64 );
@@ -376,7 +375,7 @@ void DynamicMessage::SharedCtor(bool lock_factory) {
if (!field->is_repeated()) {
new(field_ptr) int(field->default_value_enum()->number());
} else {
- new(field_ptr) RepeatedField<int>();
+ new (field_ptr) RepeatedField<int>(arena_);
}
break;
@@ -397,7 +396,7 @@ void DynamicMessage::SharedCtor(bool lock_factory) {
ArenaStringPtr* asp = new(field_ptr) ArenaStringPtr();
asp->UnsafeSetDefault(default_value);
} else {
- new(field_ptr) RepeatedPtrField<string>();
+ new (field_ptr) RepeatedPtrField<string>(arena_);
}
break;
}
@@ -412,15 +411,28 @@ void DynamicMessage::SharedCtor(bool lock_factory) {
// when the constructor is called inside GetPrototype(), in which
// case we have already locked the factory.
if (lock_factory) {
- new (field_ptr) DynamicMapField(
- type_info_->factory->GetPrototype(field->message_type()));
+ if (arena_ != NULL) {
+ 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 {
- new (field_ptr)
- DynamicMapField(type_info_->factory->GetPrototypeNoLock(
- field->message_type()));
+ if (arena_ != NULL) {
+ new (field_ptr)
+ DynamicMapField(type_info_->factory->GetPrototypeNoLock(
+ field->message_type()),
+ arena_);
+ } else {
+ new (field_ptr)
+ DynamicMapField(type_info_->factory->GetPrototypeNoLock(
+ field->message_type()));
+ }
}
} else {
- new (field_ptr) RepeatedPtrField<Message>();
+ new (field_ptr) RepeatedPtrField<Message>(arena_);
}
}
break;
@@ -568,19 +580,17 @@ void DynamicMessage::CrossLinkPrototypes() {
}
}
-Message* DynamicMessage::New() const {
- void* new_base = operator new(type_info_->size);
- memset(new_base, 0, type_info_->size);
- return new(new_base) DynamicMessage(type_info_);
-}
+Message* DynamicMessage::New() const { return New(NULL); }
Message* DynamicMessage::New(::google::protobuf::Arena* arena) const {
if (arena != NULL) {
- Message* message = New();
- arena->Own(message);
- return message;
+ void* new_base = Arena::CreateArray<char>(arena, type_info_->size);
+ memset(new_base, 0, type_info_->size);
+ return new (new_base) DynamicMessage(type_info_, arena);
} else {
- return New();
+ void* new_base = operator new(type_info_->size);
+ memset(new_base, 0, type_info_->size);
+ return new (new_base) DynamicMessage(type_info_);
}
}
diff --git a/src/google/protobuf/dynamic_message_unittest.cc b/src/google/protobuf/dynamic_message_unittest.cc
index fe51d8cf..34f3641b 100644
--- a/src/google/protobuf/dynamic_message_unittest.cc
+++ b/src/google/protobuf/dynamic_message_unittest.cc
@@ -60,7 +60,7 @@
namespace google {
namespace protobuf {
-class DynamicMessageTest : public testing::Test {
+class DynamicMessageTest : public ::testing::TestWithParam<bool> {
protected:
DescriptorPool pool_;
DynamicMessageFactory factory_;
@@ -144,38 +144,54 @@ TEST_F(DynamicMessageTest, Defaults) {
reflection_tester.ExpectClearViaReflection(*prototype_);
}
-TEST_F(DynamicMessageTest, IndependentOffsets) {
+TEST_P(DynamicMessageTest, IndependentOffsets) {
// Check that all fields have independent offsets by setting each
// one to a unique value then checking that they all still have those
// unique values (i.e. they don't stomp each other).
- google::protobuf::scoped_ptr<Message> message(prototype_->New());
+ Arena arena;
+ Message* message = prototype_->New(GetParam()? &arena : NULL);
TestUtil::ReflectionTester reflection_tester(descriptor_);
- reflection_tester.SetAllFieldsViaReflection(message.get());
+ reflection_tester.SetAllFieldsViaReflection(message);
reflection_tester.ExpectAllFieldsSetViaReflection(*message);
+
+ if (!GetParam()) {
+ delete message;
+ }
}
-TEST_F(DynamicMessageTest, Extensions) {
+TEST_P(DynamicMessageTest, Extensions) {
// Check that extensions work.
- google::protobuf::scoped_ptr<Message> message(extensions_prototype_->New());
+ Arena arena;
+ Message* message = extensions_prototype_->New(GetParam()? &arena : NULL);
TestUtil::ReflectionTester reflection_tester(extensions_descriptor_);
- reflection_tester.SetAllFieldsViaReflection(message.get());
+ reflection_tester.SetAllFieldsViaReflection(message);
reflection_tester.ExpectAllFieldsSetViaReflection(*message);
+
+ if (!GetParam()) {
+ delete message;
+ }
}
-TEST_F(DynamicMessageTest, PackedFields) {
+TEST_P(DynamicMessageTest, PackedFields) {
// Check that packed fields work properly.
- google::protobuf::scoped_ptr<Message> message(packed_prototype_->New());
+ Arena arena;
+ Message* message = packed_prototype_->New(GetParam()? &arena : NULL);
TestUtil::ReflectionTester reflection_tester(packed_descriptor_);
- reflection_tester.SetPackedFieldsViaReflection(message.get());
+ reflection_tester.SetPackedFieldsViaReflection(message);
reflection_tester.ExpectPackedFieldsSetViaReflection(*message);
+
+ if (!GetParam()) {
+ delete message;
+ }
}
-TEST_F(DynamicMessageTest, Oneof) {
+TEST_P(DynamicMessageTest, Oneof) {
// Check that oneof fields work properly.
- google::protobuf::scoped_ptr<Message> message(oneof_prototype_->New());
+ Arena arena;
+ Message* message = oneof_prototype_->New(GetParam()? &arena : NULL);
// Check default values.
const Descriptor* descriptor = message->GetDescriptor();
@@ -226,29 +242,46 @@ TEST_F(DynamicMessageTest, Oneof) {
// Check set functions.
TestUtil::ReflectionTester reflection_tester(oneof_descriptor_);
- reflection_tester.SetOneofViaReflection(message.get());
+ reflection_tester.SetOneofViaReflection(message);
reflection_tester.ExpectOneofSetViaReflection(*message);
+
+ if (!GetParam()) {
+ delete message;
+ }
}
-TEST_F(DynamicMessageTest, SpaceUsed) {
+TEST_P(DynamicMessageTest, SpaceUsed) {
// Test that SpaceUsed() works properly
// Since we share the implementation with generated messages, we don't need
// to test very much here. Just make sure it appears to be working.
- google::protobuf::scoped_ptr<Message> message(prototype_->New());
+ Arena arena;
+ Message* message = prototype_->New(GetParam()? &arena : NULL);
TestUtil::ReflectionTester reflection_tester(descriptor_);
int initial_space_used = message->SpaceUsed();
- reflection_tester.SetAllFieldsViaReflection(message.get());
+ reflection_tester.SetAllFieldsViaReflection(message);
EXPECT_LT(initial_space_used, message->SpaceUsed());
+
+ if (!GetParam()) {
+ delete message;
+ }
}
TEST_F(DynamicMessageTest, Arena) {
Arena arena;
Message* message = prototype_->New(&arena);
- (void)message; // avoid unused-variable error.
+ Message* extension_message = extensions_prototype_->New(&arena);
+ Message* packed_message = packed_prototype_->New(&arena);
+ Message* oneof_message = oneof_prototype_->New(&arena);
+
+ // avoid unused-variable error.
+ (void)message;
+ (void)extension_message;
+ (void)packed_message;
+ (void)oneof_message;
// Return without freeing: should not leak.
}
@@ -286,6 +319,7 @@ TEST_F(DynamicMessageTest, Proto3) {
delete message;
}
+INSTANTIATE_TEST_CASE_P(UseArena, DynamicMessageTest, ::testing::Bool());
} // namespace protobuf
} // namespace google
diff --git a/src/google/protobuf/empty.pb.cc b/src/google/protobuf/empty.pb.cc
index caa019e8..ffff80b9 100644
--- a/src/google/protobuf/empty.pb.cc
+++ b/src/google/protobuf/empty.pb.cc
@@ -180,9 +180,6 @@ const Empty& Empty::default_instance() {
return *internal_default_instance();
}
-Empty* Empty::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<Empty>(arena);
-}
void Empty::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Empty)
@@ -338,5 +335,12 @@ void Empty::InternalSwap(Empty* other) {
// @@protoc_insertion_point(namespace_scope)
} // namespace protobuf
} // namespace google
+namespace google {
+namespace protobuf {
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Empty* Arena::CreateMessage< ::google::protobuf::Empty >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::Empty >(arena);
+}
+} // namespace protobuf
+} // namespace google
// @@protoc_insertion_point(global_scope)
diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h
index 76e0e4c6..2fef9a43 100644
--- a/src/google/protobuf/empty.pb.h
+++ b/src/google/protobuf/empty.pb.h
@@ -1,8 +1,8 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/empty.proto
-#ifndef PROTOBUF_google_2fprotobuf_2fempty_2eproto__INCLUDED
-#define PROTOBUF_google_2fprotobuf_2fempty_2eproto__INCLUDED
+#ifndef PROTOBUF_google_2fprotobuf_2fempty_2eproto_INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fempty_2eproto_INCLUDED
#include <string>
@@ -57,6 +57,11 @@ LIBPROTOBUF_EXPORT extern EmptyDefaultTypeInternal _Empty_default_instance_;
} // namespace google
namespace google {
namespace protobuf {
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Empty* Arena::CreateMessage< ::google::protobuf::Empty>(Arena*);
+} // namespace protobuf
+} // namespace google
+namespace google {
+namespace protobuf {
// ===================================================================
@@ -111,9 +116,13 @@ class LIBPROTOBUF_EXPORT Empty : public ::google::protobuf::Message /* @@protoc_
// implements Message ----------------------------------------------
- inline Empty* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Empty* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Empty>(NULL);
+ }
- Empty* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Empty* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Empty>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Empty& from);
@@ -187,4 +196,4 @@ class LIBPROTOBUF_EXPORT Empty : public ::google::protobuf::Message /* @@protoc_
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_google_2fprotobuf_2fempty_2eproto__INCLUDED
+#endif // PROTOBUF_google_2fprotobuf_2fempty_2eproto_INCLUDED
diff --git a/src/google/protobuf/extension_set.cc b/src/google/protobuf/extension_set.cc
index cf6b6fb4..8f104800 100644
--- a/src/google/protobuf/extension_set.cc
+++ b/src/google/protobuf/extension_set.cc
@@ -33,6 +33,7 @@
// Sanjay Ghemawat, Jeff Dean, and others.
#include <google/protobuf/stubs/hash.h>
+#include <utility>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/extension_set.h>
@@ -750,8 +751,10 @@ MessageLite* ExtensionSet::AddMessage(int number, FieldType type,
// RepeatedPtrField<MessageLite> does not know how to Add() since it cannot
// allocate an abstract object, so we have to be tricky.
- MessageLite* result = extension->repeated_message_value
- ->AddFromCleared<GenericTypeHandler<MessageLite> >();
+ MessageLite* result =
+ reinterpret_cast< ::google::protobuf::internal::RepeatedPtrFieldBase*>(
+ extension->repeated_message_value)
+ ->AddFromCleared<GenericTypeHandler<MessageLite> >();
if (result == NULL) {
result = prototype.New(arena_);
extension->repeated_message_value->AddAllocated(result);
@@ -925,8 +928,10 @@ void ExtensionSet::InternalExtensionMergeFrom(
other_extension.repeated_message_value;
for (int i = 0; i < other_repeated_message->size(); i++) {
const MessageLite& other_message = other_repeated_message->Get(i);
- MessageLite* target = extension->repeated_message_value
- ->AddFromCleared<GenericTypeHandler<MessageLite> >();
+ MessageLite* target =
+ reinterpret_cast< ::google::protobuf::internal::RepeatedPtrFieldBase*>(
+ extension->repeated_message_value)
+ ->AddFromCleared<GenericTypeHandler<MessageLite> >();
if (target == NULL) {
target = other_message.New(arena_);
extension->repeated_message_value->AddAllocated(target);
@@ -1747,6 +1752,9 @@ void ExtensionSet::Extension::Free() {
// Defined in extension_set_heavy.cc.
// int ExtensionSet::Extension::SpaceUsedExcludingSelf() const
+// Dummy key method to avoid weak vtable.
+void ExtensionSet::LazyMessageExtension::UnusedKeyMethod() {}
+
// ==================================================================
// Default repeated field instances for iterator-compatible accessors
diff --git a/src/google/protobuf/extension_set.h b/src/google/protobuf/extension_set.h
index 0a5d98f2..b0f3b8dd 100644
--- a/src/google/protobuf/extension_set.h
+++ b/src/google/protobuf/extension_set.h
@@ -483,6 +483,8 @@ class LIBPROTOBUF_EXPORT ExtensionSet {
}
private:
+ virtual void UnusedKeyMethod(); // Dummy key method to avoid weak vtable.
+
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(LazyMessageExtension);
};
struct Extension {
diff --git a/src/google/protobuf/extension_set_heavy.cc b/src/google/protobuf/extension_set_heavy.cc
index fad31340..432c0fd7 100644
--- a/src/google/protobuf/extension_set_heavy.cc
+++ b/src/google/protobuf/extension_set_heavy.cc
@@ -259,8 +259,10 @@ MessageLite* ExtensionSet::AddMessage(const FieldDescriptor* descriptor,
// RepeatedPtrField<Message> does not know how to Add() since it cannot
// allocate an abstract object, so we have to be tricky.
- MessageLite* result = extension->repeated_message_value
- ->AddFromCleared<GenericTypeHandler<MessageLite> >();
+ MessageLite* result =
+ reinterpret_cast< ::google::protobuf::internal::RepeatedPtrFieldBase*>(
+ extension->repeated_message_value)
+ ->AddFromCleared<GenericTypeHandler<MessageLite> >();
if (result == NULL) {
const MessageLite* prototype;
if (extension->repeated_message_value->size() == 0) {
@@ -391,7 +393,9 @@ size_t ExtensionSet::Extension::SpaceUsedExcludingSelfLong() const {
// type handler.
total_size +=
sizeof(*repeated_message_value) +
- RepeatedMessage_SpaceUsedExcludingSelfLong(repeated_message_value);
+ RepeatedMessage_SpaceUsedExcludingSelfLong(
+ reinterpret_cast< ::google::protobuf::internal::RepeatedPtrFieldBase*>(
+ repeated_message_value));
break;
}
} else {
diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc
index 3e71b253..b8b6e428 100644
--- a/src/google/protobuf/extension_set_unittest.cc
+++ b/src/google/protobuf/extension_set_unittest.cc
@@ -792,11 +792,16 @@ TEST(ExtensionSetTest, SpaceUsedExcludingSelf) {
message.AddExtension(unittest::repeated_##type##_extension, value); \
EXPECT_EQ(empty_repeated_field_size, message.SpaceUsed()) << #type; \
message.ClearExtension(unittest::repeated_##type##_extension); \
+ const int old_capacity = \
+ message.GetRepeatedExtension(unittest::repeated_##type##_extension) \
+ .Capacity(); \
+ EXPECT_GE(old_capacity, kMinRepeatedFieldAllocationSize); \
for (int i = 0; i < 16; ++i) { \
message.AddExtension(unittest::repeated_##type##_extension, value); \
} \
- int expected_size = sizeof(cpptype) * (16 - \
- kMinRepeatedFieldAllocationSize) + empty_repeated_field_size; \
+ int expected_size = sizeof(cpptype) * \
+ (message.GetRepeatedExtension(unittest::repeated_##type##_extension) \
+ .Capacity() - old_capacity) + empty_repeated_field_size; \
EXPECT_LE(expected_size, message.SpaceUsed()) << #type; \
} while (0)
diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc
index c55a697a..abee4fe7 100644
--- a/src/google/protobuf/field_mask.pb.cc
+++ b/src/google/protobuf/field_mask.pb.cc
@@ -169,13 +169,6 @@ const FieldMask& FieldMask::default_instance() {
return *internal_default_instance();
}
-FieldMask* FieldMask::New(::google::protobuf::Arena* arena) const {
- FieldMask* n = new FieldMask;
- if (arena != NULL) {
- arena->Own(n);
- }
- return n;
-}
void FieldMask::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FieldMask)
@@ -355,7 +348,7 @@ void FieldMask::Swap(FieldMask* other) {
}
void FieldMask::InternalSwap(FieldMask* other) {
using std::swap;
- paths_.InternalSwap(&other->paths_);
+ paths_.InternalSwap(CastToBase(&other->paths_));
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
@@ -369,5 +362,12 @@ void FieldMask::InternalSwap(FieldMask* other) {
// @@protoc_insertion_point(namespace_scope)
} // namespace protobuf
} // namespace google
+namespace google {
+namespace protobuf {
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::FieldMask* Arena::Create< ::google::protobuf::FieldMask >(Arena* arena) {
+ return Arena::CreateInternal< ::google::protobuf::FieldMask >(arena);
+}
+} // namespace protobuf
+} // namespace google
// @@protoc_insertion_point(global_scope)
diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h
index d57a4494..2d75967e 100644
--- a/src/google/protobuf/field_mask.pb.h
+++ b/src/google/protobuf/field_mask.pb.h
@@ -1,8 +1,8 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/field_mask.proto
-#ifndef PROTOBUF_google_2fprotobuf_2ffield_5fmask_2eproto__INCLUDED
-#define PROTOBUF_google_2fprotobuf_2ffield_5fmask_2eproto__INCLUDED
+#ifndef PROTOBUF_google_2fprotobuf_2ffield_5fmask_2eproto_INCLUDED
+#define PROTOBUF_google_2fprotobuf_2ffield_5fmask_2eproto_INCLUDED
#include <string>
@@ -57,6 +57,11 @@ LIBPROTOBUF_EXPORT extern FieldMaskDefaultTypeInternal _FieldMask_default_instan
} // namespace google
namespace google {
namespace protobuf {
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::FieldMask* Arena::Create< ::google::protobuf::FieldMask>(Arena*);
+} // namespace protobuf
+} // namespace google
+namespace google {
+namespace protobuf {
// ===================================================================
@@ -104,9 +109,13 @@ class LIBPROTOBUF_EXPORT FieldMask : public ::google::protobuf::Message /* @@pro
// implements Message ----------------------------------------------
- inline FieldMask* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline FieldMask* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<FieldMask>(NULL);
+ }
- FieldMask* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ FieldMask* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<FieldMask>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const FieldMask& from);
@@ -264,4 +273,4 @@ FieldMask::mutable_paths() {
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_google_2fprotobuf_2ffield_5fmask_2eproto__INCLUDED
+#endif // PROTOBUF_google_2fprotobuf_2ffield_5fmask_2eproto_INCLUDED
diff --git a/src/google/protobuf/generated_enum_reflection.h b/src/google/protobuf/generated_enum_reflection.h
index fdcdc277..983d3185 100644
--- a/src/google/protobuf/generated_enum_reflection.h
+++ b/src/google/protobuf/generated_enum_reflection.h
@@ -41,7 +41,6 @@
#include <string>
-#include <google/protobuf/stubs/template_util.h>
#include <google/protobuf/generated_enum_util.h>
namespace google {
diff --git a/src/google/protobuf/generated_enum_util.h b/src/google/protobuf/generated_enum_util.h
index e4242055..4f5ded5b 100644
--- a/src/google/protobuf/generated_enum_util.h
+++ b/src/google/protobuf/generated_enum_util.h
@@ -31,7 +31,7 @@
#ifndef GOOGLE_PROTOBUF_GENERATED_ENUM_UTIL_H__
#define GOOGLE_PROTOBUF_GENERATED_ENUM_UTIL_H__
-#include <google/protobuf/stubs/template_util.h>
+#include <google/protobuf/stubs/type_traits.h>
namespace google {
namespace protobuf {
diff --git a/src/google/protobuf/generated_message_reflection.cc b/src/google/protobuf/generated_message_reflection.cc
index f0f207ea..b0c975b4 100644
--- a/src/google/protobuf/generated_message_reflection.cc
+++ b/src/google/protobuf/generated_message_reflection.cc
@@ -1124,9 +1124,6 @@ string GeneratedMessageReflection::GetString(
return GetField<ArenaStringPtr>(message, field).Get();
}
}
-
- GOOGLE_LOG(FATAL) << "Can't get here.";
- return GetEmptyString(); // Make compiler happy.
}
}
@@ -1144,9 +1141,6 @@ const string& GeneratedMessageReflection::GetStringReference(
return GetField<ArenaStringPtr>(message, field).Get();
}
}
-
- GOOGLE_LOG(FATAL) << "Can't get here.";
- return GetEmptyString(); // Make compiler happy.
}
}
@@ -1188,9 +1182,6 @@ string GeneratedMessageReflection::GetRepeatedString(
case FieldOptions::STRING:
return GetRepeatedPtrField<string>(message, field, index);
}
-
- GOOGLE_LOG(FATAL) << "Can't get here.";
- return GetEmptyString(); // Make compiler happy.
}
}
@@ -1206,9 +1197,6 @@ const string& GeneratedMessageReflection::GetRepeatedStringReference(
case FieldOptions::STRING:
return GetRepeatedPtrField<string>(message, field, index);
}
-
- GOOGLE_LOG(FATAL) << "Can't get here.";
- return GetEmptyString(); // Make compiler happy.
}
}
diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h
index 02ecba61..3c6701cf 100644
--- a/src/google/protobuf/generated_message_reflection.h
+++ b/src/google/protobuf/generated_message_reflection.h
@@ -655,12 +655,9 @@ class LIBPROTOBUF_EXPORT GeneratedMessageReflection PROTOBUF_FINAL : public Refl
// dynamic_cast_if_available() implements this logic. If RTTI is
// enabled, it does a dynamic_cast. If RTTI is disabled, it just returns
// NULL.
-//
-// If you need to compile without RTTI, simply #define GOOGLE_PROTOBUF_NO_RTTI.
-// On MSVC, this should be detected automatically.
template<typename To, typename From>
inline To dynamic_cast_if_available(From from) {
-#if defined(GOOGLE_PROTOBUF_NO_RTTI) || (defined(_MSC_VER)&&!defined(_CPPRTTI))
+#ifdef GOOGLE_PROTOBUF_NO_RTTI
// Avoid the compiler warning about unused variables.
(void)from;
return NULL;
@@ -688,8 +685,7 @@ T* DynamicCastToGenerated(const Message* from) {
const Message* unused = static_cast<T*>(NULL);
(void)unused;
-#if defined(GOOGLE_PROTOBUF_NO_RTTI) || \
- (defined(_MSC_VER) && !defined(_CPPRTTI))
+#ifdef GOOGLE_PROTOBUF_NO_RTTI
bool ok = &T::default_instance() ==
from->GetReflection()->GetMessageFactory()->GetPrototype(
from->GetDescriptor());
diff --git a/src/google/protobuf/generated_message_table_driven_lite.h b/src/google/protobuf/generated_message_table_driven_lite.h
index 20b4da21..4dfbf678 100644
--- a/src/google/protobuf/generated_message_table_driven_lite.h
+++ b/src/google/protobuf/generated_message_table_driven_lite.h
@@ -307,6 +307,7 @@ inline bool HandleEnum(const ParseTable& table, io::CodedInputStream* input,
class RepeatedMessageTypeHandler {
public:
typedef MessageLite Type;
+ typedef MessageLite WeakType;
static Arena* GetArena(Type* t) { return t->GetArena(); }
static void* GetMaybeArenaPointer(Type* t) {
return t->GetMaybeArenaPointer();
@@ -351,7 +352,7 @@ inline bool ReadMessage(io::CodedInputStream* input, MessageLite* value) {
std::pair<io::CodedInputStream::Limit, int> p =
input->IncrementRecursionDepthAndPushLimit(length);
if (GOOGLE_PREDICT_FALSE(p.second < 0 ||
- !value->MergePartialFromCodedStream(input))) {
+ !value->MergePartialFromCodedStream(input))) {
return false;
}
@@ -394,7 +395,8 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
continue;
}
- if (GOOGLE_PREDICT_FALSE(!UnknownFieldHandler::Skip(msg, table, input, tag))) {
+ if (GOOGLE_PREDICT_FALSE(
+ !UnknownFieldHandler::Skip(msg, table, input, tag))) {
return false;
}
@@ -421,7 +423,7 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
#define HANDLE_TYPE(TYPE, CPPTYPE) \
case (WireFormatLite::TYPE_##TYPE): { \
CPPTYPE value; \
- if (GOOGLE_PREDICT_FALSE( \
+ if (GOOGLE_PREDICT_FALSE( \
(!WireFormatLite::ReadPrimitive< \
CPPTYPE, WireFormatLite::TYPE_##TYPE>(input, &value)))) { \
return false; \
@@ -432,8 +434,8 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
case (WireFormatLite::TYPE_##TYPE) | kRepeatedMask: { \
google::protobuf::RepeatedField<CPPTYPE>* values = \
Raw<google::protobuf::RepeatedField<CPPTYPE> >(msg, offset); \
- if (GOOGLE_PREDICT_FALSE((!WireFormatLite::ReadRepeatedPrimitive< \
- CPPTYPE, WireFormatLite::TYPE_##TYPE>( \
+ if (GOOGLE_PREDICT_FALSE((!WireFormatLite::ReadRepeatedPrimitive< \
+ CPPTYPE, WireFormatLite::TYPE_##TYPE>( \
data->tag_size, tag, input, values)))) { \
return false; \
} \
@@ -442,7 +444,7 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
case (WireFormatLite::TYPE_##TYPE) | kOneofMask: { \
uint32* oneof_case = Raw<uint32>(msg, table.oneof_case_offset); \
CPPTYPE value; \
- if (GOOGLE_PREDICT_FALSE( \
+ if (GOOGLE_PREDICT_FALSE( \
(!WireFormatLite::ReadPrimitive< \
CPPTYPE, WireFormatLite::TYPE_##TYPE>(input, &value)))) { \
return false; \
@@ -578,29 +580,32 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
}
#endif
case WireFormatLite::TYPE_ENUM: {
- if (GOOGLE_PREDICT_FALSE((!HandleEnum<UnknownFieldHandler, InternalMetadata,
- Cardinality_SINGULAR>(
- table, input, msg, has_bits, presence_index, offset, tag,
- field_number)))) {
+ if (GOOGLE_PREDICT_FALSE(
+ (!HandleEnum<UnknownFieldHandler, InternalMetadata,
+ Cardinality_SINGULAR>(
+ table, input, msg, has_bits, presence_index, offset, tag,
+ field_number)))) {
return false;
}
break;
}
case WireFormatLite::TYPE_ENUM | kRepeatedMask: {
- if (GOOGLE_PREDICT_FALSE((!HandleEnum<UnknownFieldHandler, InternalMetadata,
- Cardinality_REPEATED>(
- table, input, msg, has_bits, presence_index, offset, tag,
- field_number)))) {
+ if (GOOGLE_PREDICT_FALSE(
+ (!HandleEnum<UnknownFieldHandler, InternalMetadata,
+ Cardinality_REPEATED>(
+ table, input, msg, has_bits, presence_index, offset, tag,
+ field_number)))) {
return false;
}
break;
}
case WireFormatLite::TYPE_ENUM | kOneofMask: {
uint32* oneof_case = Raw<uint32>(msg, table.oneof_case_offset);
- if (GOOGLE_PREDICT_FALSE((!HandleEnum<UnknownFieldHandler, InternalMetadata,
- Cardinality_ONEOF>(
- table, input, msg, oneof_case, presence_index, offset, tag,
- field_number)))) {
+ if (GOOGLE_PREDICT_FALSE(
+ (!HandleEnum<UnknownFieldHandler, InternalMetadata,
+ Cardinality_ONEOF>(table, input, msg, oneof_case,
+ presence_index, offset, tag,
+ field_number)))) {
return false;
}
break;
@@ -619,8 +624,8 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
*submsg_holder = submsg;
}
- if (GOOGLE_PREDICT_FALSE(!WireFormatLite::ReadGroup(
- field_number, input, submsg))) {
+ if (GOOGLE_PREDICT_FALSE(
+ !WireFormatLite::ReadGroup(field_number, input, submsg))) {
return false;
}
@@ -635,8 +640,8 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
MessageLite* submsg =
MergePartialFromCodedStreamHelper::Add(field, prototype);
- if (GOOGLE_PREDICT_FALSE(!WireFormatLite::ReadGroup(
- field_number, input, submsg))) {
+ if (GOOGLE_PREDICT_FALSE(
+ !WireFormatLite::ReadGroup(field_number, input, submsg))) {
return false;
}
@@ -727,7 +732,7 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
case WireFormatLite::TYPE_##TYPE: { \
google::protobuf::RepeatedField<CPPTYPE>* values = \
Raw<google::protobuf::RepeatedField<CPPTYPE> >(msg, offset); \
- if (GOOGLE_PREDICT_FALSE( \
+ if (GOOGLE_PREDICT_FALSE( \
(!WireFormatLite::ReadPackedPrimitive< \
CPPTYPE, WireFormatLite::TYPE_##TYPE>(input, values)))) { \
return false; \
@@ -809,7 +814,8 @@ bool MergePartialFromCodedStreamImpl(MessageLite* msg, const ParseTable& table,
}
// process unknown field.
- if (GOOGLE_PREDICT_FALSE(!UnknownFieldHandler::Skip(msg, table, input, tag))) {
+ if (GOOGLE_PREDICT_FALSE(
+ !UnknownFieldHandler::Skip(msg, table, input, tag))) {
return false;
}
}
diff --git a/src/google/protobuf/generated_message_util.h b/src/google/protobuf/generated_message_util.h
index 8ebfc13b..cd74b45e 100644
--- a/src/google/protobuf/generated_message_util.h
+++ b/src/google/protobuf/generated_message_util.h
@@ -47,6 +47,7 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/has_bits.h>
+#include <google/protobuf/implicit_weak_message.h>
#include <google/protobuf/map_entry_lite.h>
#include <google/protobuf/message_lite.h>
#include <google/protobuf/wire_format_lite.h>
@@ -120,6 +121,21 @@ template <class Type> bool AllAreInitialized(const Type& t) {
return true;
}
+// "Weak" variant of AllAreInitialized, used to implement implicit weak fields.
+// This version operates on MessageLite to avoid introducing a dependency on the
+// concrete message type.
+template <class T>
+bool AllAreInitializedWeak(const ::google::protobuf::RepeatedPtrField<T>& t) {
+ for (int i = t.size(); --i >= 0;) {
+ if (!reinterpret_cast<const ::google::protobuf::internal::RepeatedPtrFieldBase&>(t)
+ .Get< ::google::protobuf::internal::ImplicitWeakTypeHandler<T> >(i)
+ .IsInitialized()) {
+ return false;
+ }
+ }
+ return true;
+}
+
LIBPROTOBUF_EXPORT void InitProtobufDefaults();
struct LIBPROTOBUF_EXPORT FieldMetadata {
diff --git a/src/google/protobuf/implicit_weak_message.h b/src/google/protobuf/implicit_weak_message.h
index 12cc7db9..a822172e 100644
--- a/src/google/protobuf/implicit_weak_message.h
+++ b/src/google/protobuf/implicit_weak_message.h
@@ -35,10 +35,16 @@
#include <google/protobuf/arena.h>
#include <google/protobuf/message_lite.h>
+// This file is logically internal-only and should only be used by protobuf
+// generated code.
+
namespace google {
namespace protobuf {
namespace internal {
+// An implementation of MessageLite that treats all data as unknown. This type
+// acts as a placeholder for an implicit weak field in the case where the true
+// message type does not get linked into the binary.
class LIBPROTOBUF_EXPORT ImplicitWeakMessage : public MessageLite {
public:
ImplicitWeakMessage() : arena_(NULL) {}
@@ -69,7 +75,7 @@ class LIBPROTOBUF_EXPORT ImplicitWeakMessage : public MessageLite {
output->WriteString(data_);
}
- int GetCachedSize() const { return data_.size(); }
+ int GetCachedSize() const { return static_cast<int>(data_.size()); }
typedef void InternalArenaConstructable_;
@@ -79,6 +85,49 @@ class LIBPROTOBUF_EXPORT ImplicitWeakMessage : public MessageLite {
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImplicitWeakMessage);
};
+// A type handler for use with implicit weak repeated message fields.
+template <typename ImplicitWeakType>
+class ImplicitWeakTypeHandler {
+ public:
+ typedef ImplicitWeakType Type;
+ typedef ::google::protobuf::MessageLite WeakType;
+#if LANG_CXX11
+ static const bool Moveable = false;
+#endif
+
+ // With implicit weak fields, we need separate NewFromPrototype and
+ // NewFromPrototypeWeak functions. The former is used when we want to create a
+ // strong dependency on the message type, and it just delegates to the
+ // GenericTypeHandler. The latter avoids creating a strong dependency, by
+ // simply calling MessageLite::New.
+ static inline ::google::protobuf::MessageLite* NewFromPrototype(
+ const ::google::protobuf::MessageLite* prototype, ::google::protobuf::Arena* arena = NULL) {
+ return prototype->New(arena);
+ }
+
+ static inline void Delete(::google::protobuf::MessageLite* value, Arena* arena) {
+ if (arena == NULL) {
+ delete value;
+ }
+ }
+ static inline ::google::protobuf::Arena* GetArena(::google::protobuf::MessageLite* value) {
+ return value->GetArena();
+ }
+ static inline void* GetMaybeArenaPointer(::google::protobuf::MessageLite* value) {
+ return value->GetArena();
+ }
+ static inline void Clear(::google::protobuf::MessageLite* value) {
+ value->Clear();
+ }
+ static void Merge(const ::google::protobuf::MessageLite& from,
+ ::google::protobuf::MessageLite* to) {
+ to->CheckTypeAndMergeFrom(from);
+ }
+ static inline size_t SpaceUsedLong(const Type& value) {
+ return value.SpaceUsedLong();
+ }
+};
+
extern ::google::protobuf::internal::ExplicitlyConstructed<ImplicitWeakMessage>
implicit_weak_message_default_instance;
diff --git a/src/google/protobuf/io/coded_stream.cc b/src/google/protobuf/io/coded_stream.cc
index 79cff2c7..d3bc7c6d 100644
--- a/src/google/protobuf/io/coded_stream.cc
+++ b/src/google/protobuf/io/coded_stream.cc
@@ -121,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 GOOGLE_PREDICT_TRUE(byte_limit >= 0 &&
- byte_limit <= INT_MAX - current_position &&
- byte_limit < current_limit_ - current_position) {
+ if (GOOGLE_PREDICT_TRUE(byte_limit >= 0 &&
+ byte_limit <= INT_MAX - current_position &&
+ byte_limit < current_limit_ - current_position)) {
current_limit_ = current_position + byte_limit;
RecomputeBufferLimits();
}
@@ -173,10 +173,7 @@ int CodedInputStream::BytesUntilLimit() const {
return current_limit_ - current_position;
}
-void CodedInputStream::SetTotalBytesLimit(
- int total_bytes_limit, int warning_threshold) {
- (void) warning_threshold;
-
+void CodedInputStream::SetTotalBytesLimit(int total_bytes_limit) {
// Make sure the limit isn't already past, since this could confuse other
// code.
int current_position = CurrentPosition();
diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h
index 02d87ea4..ec85147b 100644
--- a/src/google/protobuf/io/coded_stream.h
+++ b/src/google/protobuf/io/coded_stream.h
@@ -367,42 +367,32 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
// Total Bytes Limit -----------------------------------------------
// To prevent malicious users from sending excessively large messages
- // and causing integer overflows or memory exhaustion, CodedInputStream
- // imposes a hard limit on the total number of bytes it will read.
+ // and causing memory exhaustion, CodedInputStream imposes a hard limit on
+ // the total number of bytes it will read.
// Sets the maximum number of bytes that this CodedInputStream will read
- // before refusing to continue. To prevent integer overflows in the
- // protocol buffers implementation, as well as to prevent servers from
- // allocating enormous amounts of memory to hold parsed messages, the
- // maximum message length should be limited to the shortest length that
- // will not harm usability. The theoretical shortest message that could
- // cause integer overflows is 512MB. The default limit is 64MB. Apps
- // should set shorter limits if possible. For backwards compatibility all
- // negative values get squashed to -1, as other negative values might have
- // special internal meanings. An error will always be printed to stderr if
- // the limit is reached.
+ // before refusing to continue. To prevent servers from allocating enormous
+ // amounts of memory to hold parsed messages, the maximum message length
+ // should be limited to the shortest length that will not harm usability.
+ // The default limit is INT_MAX (~2GB) and apps should set shorter limits
+ // if possible. An error will always be printed to stderr if the limit is
+ // reached.
//
- // This is unrelated to PushLimit()/PopLimit().
+ // Note: setting a limit less than the current read position is interpreted
+ // as a limit on the current position.
//
- // Hint: If you are reading this because your program is printing a
- // warning about dangerously large protocol messages, you may be
- // confused about what to do next. The best option is to change your
- // design such that excessively large messages are not necessary.
- // For example, try to design file formats to consist of many small
- // messages rather than a single large one. If this is infeasible,
- // you will need to increase the limit. Chances are, though, that
- // your code never constructs a CodedInputStream on which the limit
- // can be set. You probably parse messages by calling things like
- // Message::ParseFromString(). In this case, you will need to change
- // your code to instead construct some sort of ZeroCopyInputStream
- // (e.g. an ArrayInputStream), construct a CodedInputStream around
- // that, then you can adjust the limit. Then call
- // Message::ParseFromCodedStream() instead. Yes, it's more work, but
- // you're doing something unusual.
- void SetTotalBytesLimit(int total_bytes_limit, int warning_threshold);
-
- // The Total Bytes Limit minus the Current Position, or -1 if there
- // is no Total Bytes Limit.
+ // This is unrelated to PushLimit()/PopLimit().
+ void SetTotalBytesLimit(int total_bytes_limit);
+
+ PROTOBUF_RUNTIME_DEPRECATED(
+ "Please use the single parameter version of SetTotalBytesLimit(). The "
+ "second parameter is ignored.")
+ void SetTotalBytesLimit(int total_bytes_limit, int) {
+ SetTotalBytesLimit(total_bytes_limit);
+ }
+
+ // The Total Bytes Limit minus the Current Position, or -1 if the total bytes
+ // limit is INT_MAX.
int BytesUntilTotalBytesLimit() const;
// Recursion Limit -------------------------------------------------
@@ -580,8 +570,6 @@ class LIBPROTOBUF_EXPORT CodedInputStream {
// Recursion depth limit, set by SetRecursionLimit().
int recursion_limit_;
- bool disable_strict_correctness_enforcement_;
-
// See SetExtensionRegistry().
const DescriptorPool* extension_pool_;
MessageFactory* extension_factory_;
@@ -1053,8 +1041,7 @@ inline std::pair<uint32, 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 &&
- GOOGLE_PREDICT_TRUE(buffer_ + 1 < buffer_end_) &&
+ if (cutoff >= 0x80 && GOOGLE_PREDICT_TRUE(buffer_ + 1 < buffer_end_) &&
GOOGLE_PREDICT_TRUE((buffer_[0] & ~buffer_[1]) >= 0x80)) {
const uint32 kMax2ByteVarint = (0x7f << 7) + 0x7f;
uint32 tag = (1u << 7) * buffer_[1] + (buffer_[0] - 0x80);
@@ -1364,7 +1351,6 @@ inline CodedInputStream::CodedInputStream(ZeroCopyInputStream* input)
total_bytes_limit_(kDefaultTotalBytesLimit),
recursion_budget_(default_recursion_limit_),
recursion_limit_(default_recursion_limit_),
- disable_strict_correctness_enforcement_(true),
extension_pool_(NULL),
extension_factory_(NULL) {
// Eagerly Refresh() so buffer space is immediately available.
@@ -1385,7 +1371,6 @@ inline CodedInputStream::CodedInputStream(const uint8* buffer, int size)
total_bytes_limit_(kDefaultTotalBytesLimit),
recursion_budget_(default_recursion_limit_),
recursion_limit_(default_recursion_limit_),
- disable_strict_correctness_enforcement_(true),
extension_pool_(NULL),
extension_factory_(NULL) {
// Note that setting current_limit_ == size is important to prevent some
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h
index 7d9cc5c5..a75fb786 100644
--- a/src/google/protobuf/map.h
+++ b/src/google/protobuf/map.h
@@ -48,6 +48,10 @@
#include <google/protobuf/map_type_handler.h>
#include <google/protobuf/stubs/hash.h>
+#if LANG_CXX11
+#include <initializer_list>
+#endif
+
namespace google {
namespace protobuf {
@@ -741,7 +745,7 @@ class Map {
return true;
}
} else if (GOOGLE_PREDICT_FALSE(new_size <= lo_cutoff &&
- num_buckets_ > kMinTableSize)) {
+ 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
@@ -1113,6 +1117,11 @@ class Map {
}
}
}
+#if LANG_CXX11
+ void insert(std::initializer_list<value_type> values) {
+ insert(values.begin(), values.end());
+ }
+#endif
// Erase and clear
size_type erase(const key_type& key) {
diff --git a/src/google/protobuf/map_entry_lite.h b/src/google/protobuf/map_entry_lite.h
index 7c477c56..1646ce43 100644
--- a/src/google/protobuf/map_entry_lite.h
+++ b/src/google/protobuf/map_entry_lite.h
@@ -34,6 +34,7 @@
#include <assert.h>
#include <google/protobuf/arena.h>
+#include <google/protobuf/arenastring.h>
#include <google/protobuf/map.h>
#include <google/protobuf/map_type_handler.h>
#include <google/protobuf/stubs/port.h>
@@ -603,7 +604,9 @@ template <>
struct FromHelper<WireFormatLite::TYPE_STRING> {
static ArenaStringPtr From(const string& x) {
ArenaStringPtr res;
- *res.UnsafeRawStringPointer() = const_cast<string*>(&x);
+ TaggedPtr< ::std::string> ptr;
+ ptr.Set(const_cast<string*>(&x));
+ res.UnsafeSetTaggedPointer(ptr);
return res;
}
};
@@ -611,7 +614,9 @@ template <>
struct FromHelper<WireFormatLite::TYPE_BYTES> {
static ArenaStringPtr From(const string& x) {
ArenaStringPtr res;
- *res.UnsafeRawStringPointer() = const_cast<string*>(&x);
+ TaggedPtr< ::std::string> ptr;
+ ptr.Set(const_cast<string*>(&x));
+ res.UnsafeSetTaggedPointer(ptr);
return res;
}
};
diff --git a/src/google/protobuf/map_field.cc b/src/google/protobuf/map_field.cc
index 64dcc990..ec4f83e1 100644
--- a/src/google/protobuf/map_field.cc
+++ b/src/google/protobuf/map_field.cc
@@ -43,13 +43,15 @@ MapFieldBase::~MapFieldBase() {
const RepeatedPtrFieldBase& MapFieldBase::GetRepeatedField() const {
SyncRepeatedFieldWithMap();
- return *repeated_field_;
+ return *reinterpret_cast< ::google::protobuf::internal::RepeatedPtrFieldBase*>(
+ repeated_field_);
}
RepeatedPtrFieldBase* MapFieldBase::MutableRepeatedField() {
SyncRepeatedFieldWithMap();
SetRepeatedDirty();
- return repeated_field_;
+ return reinterpret_cast< ::google::protobuf::internal::RepeatedPtrFieldBase*>(
+ repeated_field_);
}
size_t MapFieldBase::SpaceUsedExcludingSelfLong() const {
@@ -130,6 +132,7 @@ DynamicMapField::DynamicMapField(const Message* default_entry)
DynamicMapField::DynamicMapField(const Message* default_entry,
Arena* arena)
: TypeDefinedMapFieldBase<MapKey, MapValueRef>(arena),
+ map_(arena),
default_entry_(default_entry) {
}
diff --git a/src/google/protobuf/map_test.cc b/src/google/protobuf/map_test.cc
index 080c71a7..d59f92d2 100644
--- a/src/google/protobuf/map_test.cc
+++ b/src/google/protobuf/map_test.cc
@@ -676,6 +676,16 @@ TEST_F(MapImplTest, InsertByIterator) {
ExpectElements(map1);
}
+#if LANG_CXX11
+TEST_F(MapImplTest, InsertByInitializerList) {
+ map_.insert({{1, 100}, {2, 200}});
+ ExpectElements({{1, 100}, {2, 200}});
+
+ map_.insert({{2, 201}, {3, 301}});
+ ExpectElements({{1, 100}, {2, 200}, {3, 301}});
+}
+#endif
+
TEST_F(MapImplTest, EraseSingleByKey) {
int32 key = 0;
int32 value = 100;
diff --git a/src/google/protobuf/map_unittest_proto3.proto b/src/google/protobuf/map_unittest_proto3.proto
deleted file mode 100644
index 16be2773..00000000
--- a/src/google/protobuf/map_unittest_proto3.proto
+++ /dev/null
@@ -1,120 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// This file is mostly equivalent to map_unittest.proto, but imports
-// unittest_proto3.proto instead of unittest.proto, so that it only
-// uses proto3 messages. This makes it suitable for testing
-// implementations which only support proto3.
-// The TestRequiredMessageMap message has been removed as there are no
-// required fields in proto3.
-syntax = "proto3";
-
-option cc_enable_arenas = true;
-option csharp_namespace = "Google.Protobuf.TestProtos";
-
-import "google/protobuf/unittest_proto3.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;
-
-// 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;
-}
-
-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;
-}
-
-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<int32 , MapEnum > map_int32_enum = 14;
- map<int32 , ForeignMessage> map_int32_foreign_message = 15;
-}
-
-// Previously, message containing enum called Type cannot be used as value of
-// map field.
-message MessageContainingEnumCalledType {
- enum Type {
- TYPE_FOO = 0;
- }
- map<int32, MessageContainingEnumCalledType> type = 1;
-}
-
-// Previously, message cannot contain map field called "entry".
-message MessageContainingMapCalledEntry {
- map<int32, int32> entry = 1;
-}
diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h
index ab018596..fc630b58 100644
--- a/src/google/protobuf/message.h
+++ b/src/google/protobuf/message.h
@@ -152,6 +152,9 @@ class CodedOutputStream; // coded_stream.h
namespace python {
class MapReflectionFriend; // scalar_map_container.h
}
+namespace expr {
+class CelMapReflectionFriend; // field_backed_map_impl.cc
+}
namespace internal {
@@ -406,9 +409,6 @@ class MutableRepeatedFieldRef;
// double the message's memory footprint, probably worse. Allocating the
// objects on-demand, on the other hand, would be expensive and prone to
// memory leaks. So, instead we ended up with this flat interface.
-//
-// TODO(kenton): Create a utility class which callers can use to read and
-// write fields from a Reflection without paying attention to the type.
class LIBPROTOBUF_EXPORT Reflection {
public:
inline Reflection() {}
@@ -815,6 +815,7 @@ class LIBPROTOBUF_EXPORT Reflection {
//
// for T = Cord and all protobuf scalar types except enums.
template<typename T>
+ PROTOBUF_RUNTIME_DEPRECATED("Please use GetRepeatedFieldRef() instead")
const RepeatedField<T>& GetRepeatedField(
const Message&, const FieldDescriptor*) const;
@@ -822,6 +823,7 @@ class LIBPROTOBUF_EXPORT Reflection {
//
// for T = Cord and all protobuf scalar types except enums.
template<typename T>
+ PROTOBUF_RUNTIME_DEPRECATED("Please use GetMutableRepeatedFieldRef() instead")
RepeatedField<T>* MutableRepeatedField(
Message*, const FieldDescriptor*) const;
@@ -830,6 +832,7 @@ class LIBPROTOBUF_EXPORT Reflection {
// for T = string, google::protobuf::internal::StringPieceField
// google::protobuf::Message & descendants.
template<typename T>
+ PROTOBUF_RUNTIME_DEPRECATED("Please use GetRepeatedFieldRef() instead")
const RepeatedPtrField<T>& GetRepeatedPtrField(
const Message&, const FieldDescriptor*) const;
@@ -838,6 +841,7 @@ class LIBPROTOBUF_EXPORT Reflection {
// for T = string, google::protobuf::internal::StringPieceField
// google::protobuf::Message & descendants.
template<typename T>
+ PROTOBUF_RUNTIME_DEPRECATED("Please use GetMutableRepeatedFieldRef() instead")
RepeatedPtrField<T>* MutableRepeatedPtrField(
Message*, const FieldDescriptor*) const;
@@ -949,6 +953,8 @@ class LIBPROTOBUF_EXPORT Reflection {
template<typename T, typename Enable>
friend class MutableRepeatedFieldRef;
friend class ::google::protobuf::python::MapReflectionFriend;
+#define GOOGLE_PROTOBUF_HAS_CEL_MAP_REFLECTION_FRIEND
+ friend class ::google::protobuf::expr::CelMapReflectionFriend;
friend class internal::MapFieldReflectionTest;
friend class internal::MapKeySorter;
friend class internal::WireFormat;
diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h
index 5cd6babc..0b2b24b2 100644
--- a/src/google/protobuf/message_lite.h
+++ b/src/google/protobuf/message_lite.h
@@ -48,6 +48,8 @@
namespace google {
namespace protobuf {
class Arena;
+template <typename T>
+class RepeatedPtrField;
namespace io {
class CodedInputStream;
class CodedOutputStream;
@@ -56,6 +58,7 @@ class ZeroCopyOutputStream;
}
namespace internal {
+class RepeatedPtrFieldBase;
class WireFormatLite;
#ifndef SWIG
@@ -380,6 +383,22 @@ class LIBPROTOBUF_EXPORT MessageLite {
virtual uint8* InternalSerializeWithCachedSizesToArray(bool deterministic,
uint8* target) const;
+ protected:
+ // CastToBase allows generated code to cast a RepeatedPtrField<T> to
+ // RepeatedPtrFieldBase. We try to restrict access to RepeatedPtrFieldBase
+ // because it is an implementation detail that user code should not access
+ // directly.
+ template <typename T>
+ static ::google::protobuf::internal::RepeatedPtrFieldBase* CastToBase(
+ ::google::protobuf::RepeatedPtrField<T>* repeated) {
+ return repeated;
+ }
+ template <typename T>
+ static const ::google::protobuf::internal::RepeatedPtrFieldBase& CastToBase(
+ const ::google::protobuf::RepeatedPtrField<T>& repeated) {
+ return repeated;
+ }
+
private:
// TODO(gerbens) make this a pure abstract function
virtual const void* InternalGetTable() const { return NULL; }
diff --git a/src/google/protobuf/reflection_ops.cc b/src/google/protobuf/reflection_ops.cc
index d1867311..eb2a0e7a 100644
--- a/src/google/protobuf/reflection_ops.cc
+++ b/src/google/protobuf/reflection_ops.cc
@@ -31,13 +31,15 @@
// Author: kenton@google.com (Kenton Varda)
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
+#include <google/protobuf/reflection_ops.h>
#include <string>
#include <vector>
-#include <google/protobuf/reflection_ops.h>
-#include <google/protobuf/descriptor.h>
+#include <google/protobuf/stubs/logging.h>
+#include <google/protobuf/stubs/common.h>
#include <google/protobuf/descriptor.pb.h>
+#include <google/protobuf/descriptor.h>
#include <google/protobuf/map_field.h>
#include <google/protobuf/unknown_field_set.h>
#include <google/protobuf/stubs/strutil.h>
@@ -46,6 +48,17 @@ namespace google {
namespace protobuf {
namespace internal {
+static const Reflection* GetReflectionOrDie(const Message& m) {
+ const Reflection* r = m.GetReflection();
+ if (r == NULL) {
+ const Descriptor* d = m.GetDescriptor();
+ const string& mtype = d ? d->name() : "unknown";
+ // RawMessage is one known type for which GetReflection() returns NULL.
+ GOOGLE_LOG(FATAL) << "Message does not support reflection (type " << mtype << ").";
+ }
+ return r;
+}
+
void ReflectionOps::Copy(const Message& from, Message* to) {
if (&from == to) return;
Clear(to);
@@ -61,8 +74,8 @@ void ReflectionOps::Merge(const Message& from, Message* to) {
<< "(merge " << descriptor->full_name()
<< " to " << to->GetDescriptor()->full_name() << ")";
- const Reflection* from_reflection = from.GetReflection();
- const Reflection* to_reflection = to->GetReflection();
+ const Reflection* from_reflection = GetReflectionOrDie(from);
+ const Reflection* to_reflection = GetReflectionOrDie(*to);
std::vector<const FieldDescriptor*> fields;
from_reflection->ListFields(from, &fields);
@@ -128,7 +141,7 @@ void ReflectionOps::Merge(const Message& from, Message* to) {
}
void ReflectionOps::Clear(Message* message) {
- const Reflection* reflection = message->GetReflection();
+ const Reflection* reflection = GetReflectionOrDie(*message);
std::vector<const FieldDescriptor*> fields;
reflection->ListFields(*message, &fields);
@@ -141,7 +154,7 @@ void ReflectionOps::Clear(Message* message) {
bool ReflectionOps::IsInitialized(const Message& message) {
const Descriptor* descriptor = message.GetDescriptor();
- const Reflection* reflection = message.GetReflection();
+ const Reflection* reflection = GetReflectionOrDie(message);
// Check required fields of this message.
for (int i = 0; i < descriptor->field_count(); i++) {
@@ -201,7 +214,7 @@ bool ReflectionOps::IsInitialized(const Message& message) {
}
void ReflectionOps::DiscardUnknownFields(Message* message) {
- const Reflection* reflection = message->GetReflection();
+ const Reflection* reflection = GetReflectionOrDie(*message);
reflection->MutableUnknownFields(message)->Clear();
@@ -248,7 +261,7 @@ void ReflectionOps::FindInitializationErrors(
const string& prefix,
std::vector<string>* errors) {
const Descriptor* descriptor = message.GetDescriptor();
- const Reflection* reflection = message.GetReflection();
+ const Reflection* reflection = GetReflectionOrDie(message);
// Check required fields of this message.
for (int i = 0; i < descriptor->field_count(); i++) {
diff --git a/src/google/protobuf/repeated_field.cc b/src/google/protobuf/repeated_field.cc
index 5ca964c1..310000aa 100644
--- a/src/google/protobuf/repeated_field.cc
+++ b/src/google/protobuf/repeated_field.cc
@@ -103,6 +103,22 @@ void RepeatedPtrFieldBase::CloseGap(int start, int num) {
rep_->allocated_size -= num;
}
+google::protobuf::MessageLite* RepeatedPtrFieldBase::AddWeak(
+ const google::protobuf::MessageLite* prototype) {
+ if (rep_ != NULL && current_size_ < rep_->allocated_size) {
+ return reinterpret_cast<google::protobuf::MessageLite*>(
+ rep_->elements[current_size_++]);
+ }
+ if (!rep_ || rep_->allocated_size == total_size_) {
+ Reserve(total_size_ + 1);
+ }
+ ++rep_->allocated_size;
+ google::protobuf::MessageLite* result = prototype ? prototype->New(arena_) :
+ Arena::CreateMessage<ImplicitWeakMessage>(arena_);
+ rep_->elements[current_size_++] = result;
+ return result;
+}
+
} // namespace internal
diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h
index 8eb6c795..5fc619f2 100644
--- a/src/google/protobuf/repeated_field.h
+++ b/src/google/protobuf/repeated_field.h
@@ -57,8 +57,8 @@
#include <google/protobuf/stubs/casts.h>
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/stubs/type_traits.h>
#include <google/protobuf/arena.h>
+#include <google/protobuf/implicit_weak_message.h>
#include <google/protobuf/message_lite.h>
#include <google/protobuf/stubs/port.h>
@@ -86,7 +86,7 @@ void LogIndexOutOfBounds(int index, int size);
template <typename Iter>
inline int CalculateReserve(Iter begin, Iter end, std::forward_iterator_tag) {
- return std::distance(begin, end);
+ return static_cast<int>(std::distance(begin, end));
}
template <typename Iter>
@@ -279,9 +279,19 @@ class RepeatedField PROTOBUF_FINAL {
// a "gap" after the field arena and before the field elements (e.g., when
// Element is double and pointer is 32bit).
static const size_t kRepHeaderSize;
- // Contains arena ptr and the elements array. We also keep the invariant that
- // if rep_ is NULL, then arena is NULL.
- Rep* rep_;
+
+ // We reuse the Rep* for an Arena* when total_size == 0, to avoid having to do
+ // an allocation in the constructor when we have an Arena.
+ union Pointer {
+ Pointer(Arena* a) : arena(a) {}
+ Arena* arena; // When total_size_ == 0.
+ Rep* rep; // When total_size_ != 0.
+ } ptr_;
+
+ Rep* rep() const {
+ GOOGLE_DCHECK_GT(total_size_, 0);
+ return ptr_.rep;
+ }
friend class Arena;
typedef void InternalArenaConstructable_;
@@ -297,7 +307,7 @@ class RepeatedField PROTOBUF_FINAL {
// Internal helper expected by Arena methods.
inline Arena* GetArenaNoVirtual() const {
- return (rep_ == NULL) ? NULL : rep_->arena;
+ return (total_size_ == 0) ? ptr_.arena : ptr_.rep->arena;
}
// Internal helper to delete all elements and deallocate the storage.
@@ -399,7 +409,12 @@ struct TypeImplementsMergeBehavior< ::std::string> {
// class TypeHandler {
// public:
// typedef MyType Type;
+// // WeakType is almost always the same as MyType, but we use it in
+// // ImplicitWeakTypeHandler.
+// typedef MyType WeakType;
// static Type* New();
+// static WeakType* NewFromPrototype(const WeakType* prototype,
+// ::google::protobuf::Arena* arena);
// static void Delete(Type*);
// static void Clear(Type*);
// static void Merge(const Type& from, Type* to);
@@ -409,31 +424,6 @@ struct TypeImplementsMergeBehavior< ::std::string> {
// };
class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase {
protected:
- // The reflection implementation needs to call protected methods directly,
- // reinterpreting pointers as being to Message instead of a specific Message
- // subclass.
- friend class GeneratedMessageReflection;
-
- // ExtensionSet stores repeated message extensions as
- // RepeatedPtrField<MessageLite>, but non-lite ExtensionSets need to implement
- // SpaceUsedLong(), and thus need to call SpaceUsedExcludingSelfLong()
- // reinterpreting MessageLite as Message. ExtensionSet also needs to make use
- // of AddFromCleared(), which is not part of the public interface.
- friend class ExtensionSet;
-
- // The MapFieldBase implementation needs to call protected methods directly,
- // reinterpreting pointers as being to Message instead of a specific Message
- // subclass.
- friend class MapFieldBase;
-
- // The table-driven MergePartialFromCodedStream implementation needs to
- // operate on RepeatedPtrField<MessageLite>.
- friend class MergePartialFromCodedStreamHelper;
-
- // To parse directly into a proto2 generated class, the upb class GMR_Handlers
- // needs to be able to modify a RepeatedPtrFieldBase directly.
- friend class upb::google_opensource::GMR_Handlers;
-
RepeatedPtrFieldBase();
explicit RepeatedPtrFieldBase(::google::protobuf::Arena* arena);
~RepeatedPtrFieldBase() {}
@@ -446,13 +436,35 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase {
int size() const;
template <typename TypeHandler>
- const typename TypeHandler::Type& Get(int index) const;
- template <typename TypeHandler>
typename TypeHandler::Type* Mutable(int index);
template <typename TypeHandler>
void Delete(int index);
template <typename TypeHandler>
typename TypeHandler::Type* Add(typename TypeHandler::Type* prototype = NULL);
+
+ public:
+ // The next few methods are public so that they can be called from generated
+ // code when implicit weak fields are used, but they should never be called by
+ // application code.
+
+ template <typename TypeHandler>
+ const typename TypeHandler::WeakType& Get(int index) const;
+
+ // Creates and adds an element using the given prototype, without introducing
+ // a link-time dependency on the concrete message type. This method is used to
+ // implement implicit weak fields. The prototype may be NULL, in which case an
+ // ImplicitWeakMessage will be used as a placeholder.
+ google::protobuf::MessageLite* AddWeak(const google::protobuf::MessageLite* prototype);
+
+ template <typename TypeHandler>
+ void Clear();
+
+ template <typename TypeHandler>
+ void MergeFrom(const RepeatedPtrFieldBase& other);
+
+ inline void InternalSwap(RepeatedPtrFieldBase* other);
+
+ protected:
#if LANG_CXX11
template <typename TypeHandler>
void Add(typename TypeHandler::Type&& value,
@@ -462,10 +474,6 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase {
template <typename TypeHandler>
void RemoveLast();
template <typename TypeHandler>
- void Clear();
- template <typename TypeHandler>
- void MergeFrom(const RepeatedPtrFieldBase& other);
- template <typename TypeHandler>
void CopyFrom(const RepeatedPtrFieldBase& other);
void CloseGap(int start, int num);
@@ -491,7 +499,6 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase {
template <typename TypeHandler>
size_t SpaceUsedExcludingSelfLong() const;
-
// Advanced memory management --------------------------------------
// Like Add(), but if there are no cleared objects to use, returns NULL.
@@ -524,9 +531,6 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase {
template <typename TypeHandler>
typename TypeHandler::Type* ReleaseCleared();
- protected:
- inline void InternalSwap(RepeatedPtrFieldBase* other);
-
template <typename TypeHandler>
void AddAllocatedInternal(typename TypeHandler::Type* value, google::protobuf::internal::true_type);
template <typename TypeHandler>
@@ -601,7 +605,33 @@ class LIBPROTOBUF_EXPORT RepeatedPtrFieldBase {
// Reserve() and MergeFrom() to reduce code size. |extend_amount| must be > 0.
void** InternalExtend(int extend_amount);
+ // The reflection implementation needs to call protected methods directly,
+ // reinterpreting pointers as being to Message instead of a specific Message
+ // subclass.
+ friend class GeneratedMessageReflection;
+
+ // ExtensionSet stores repeated message extensions as
+ // RepeatedPtrField<MessageLite>, but non-lite ExtensionSets need to implement
+ // SpaceUsedLong(), and thus need to call SpaceUsedExcludingSelfLong()
+ // reinterpreting MessageLite as Message. ExtensionSet also needs to make use
+ // of AddFromCleared(), which is not part of the public interface.
+ friend class ExtensionSet;
+
+ // The MapFieldBase implementation needs to call protected methods directly,
+ // reinterpreting pointers as being to Message instead of a specific Message
+ // subclass.
+ friend class MapFieldBase;
+
+ // The table-driven MergePartialFromCodedStream implementation needs to
+ // operate on RepeatedPtrField<MessageLite>.
+ friend class MergePartialFromCodedStreamHelper;
+
+ // To parse directly into a proto2 generated class, the upb class GMR_Handlers
+ // needs to be able to modify a RepeatedPtrFieldBase directly.
+ friend class upb::google_opensource::GMR_Handlers;
+
friend class AccessorHelper;
+
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPtrFieldBase);
};
@@ -609,6 +639,7 @@ template <typename GenericType>
class GenericTypeHandler {
public:
typedef GenericType Type;
+ typedef GenericType WeakType;
#if LANG_CXX11
static const bool Moveable = false;
#endif
@@ -636,9 +667,6 @@ class GenericTypeHandler {
static inline size_t SpaceUsedLong(const GenericType& value) {
return value.SpaceUsedLong();
}
- static inline const Type& default_instance() {
- return Type::default_instance();
- }
};
template <typename GenericType>
@@ -700,28 +728,10 @@ DECLARE_SPECIALIZATIONS_FOR_BASE_PROTO_TYPES(Message)
#undef DECLARE_SPECIALIZATIONS_FOR_BASE_PROTO_TYPES
-template <>
-inline const MessageLite& GenericTypeHandler<MessageLite>::default_instance() {
- // Yes, the behavior of the code is undefined, but this function is only
- // called when we're already deep into the world of undefined, because the
- // caller called Get(index) out of bounds.
- MessageLite* null = NULL;
- return *null;
-}
-
-template <>
-inline const Message& GenericTypeHandler<Message>::default_instance() {
- // Yes, the behavior of the code is undefined, but this function is only
- // called when we're already deep into the world of undefined, because the
- // caller called Get(index) out of bounds.
- Message* null = NULL;
- return *null;
-}
-
-
class StringTypeHandler {
public:
typedef string Type;
+ typedef string WeakType;
#if LANG_CXX11
static const bool Moveable =
std::is_move_constructible<Type>::value &&
@@ -753,9 +763,6 @@ class StringTypeHandler {
}
static inline void Clear(string* value) { value->clear(); }
static inline void Merge(const string& from, string* to) { *to = from; }
- static inline const Type& default_instance() {
- return ::google::protobuf::internal::GetEmptyString();
- }
static size_t SpaceUsedLong(const string& value) {
return sizeof(value) + StringSpaceUsedExcludingSelfLong(value);
}
@@ -766,7 +773,7 @@ class StringTypeHandler {
// RepeatedPtrField is like RepeatedField, but used for repeated strings or
// Messages.
template <typename Element>
-class RepeatedPtrField PROTOBUF_FINAL : public internal::RepeatedPtrFieldBase {
+class RepeatedPtrField PROTOBUF_FINAL : private internal::RepeatedPtrFieldBase {
public:
RepeatedPtrField();
explicit RepeatedPtrField(::google::protobuf::Arena* arena);
@@ -1025,6 +1032,8 @@ class RepeatedPtrField PROTOBUF_FINAL : public internal::RepeatedPtrFieldBase {
google::protobuf::internal::false_type);
friend class Arena;
+ friend class MessageLite;
+
typedef void InternalArenaConstructable_;
};
@@ -1035,33 +1044,25 @@ template <typename Element>
inline RepeatedField<Element>::RepeatedField()
: current_size_(0),
total_size_(0),
- rep_(NULL) {
+ ptr_(NULL) {
}
template <typename Element>
inline RepeatedField<Element>::RepeatedField(Arena* arena)
: current_size_(0),
total_size_(0),
- rep_(NULL) {
- // In case arena is NULL, then we do not create rep_, as code has an invariant
- // `rep_ == NULL then arena == NULL`.
- if (arena != NULL) {
- rep_ = reinterpret_cast<Rep*>(
- ::google::protobuf::Arena::CreateArray<char>(arena, kRepHeaderSize));
- rep_->arena = arena;
- }
+ ptr_(arena) {
}
template <typename Element>
inline RepeatedField<Element>::RepeatedField(const RepeatedField& other)
: current_size_(0),
total_size_(0),
- rep_(NULL) {
+ ptr_(NULL) {
if (other.current_size_ != 0) {
- Reserve(other.current_size_);
- CopyArray(rep_->elements,
- other.rep_->elements, other.current_size_);
- current_size_ = other.current_size_;
+ Reserve(other.size());
+ AddNAlreadyReserved(other.size());
+ CopyArray(Mutable(0), &other.Get(0), other.size());
}
}
@@ -1070,7 +1071,7 @@ template <typename Iter>
RepeatedField<Element>::RepeatedField(Iter begin, const Iter& end)
: current_size_(0),
total_size_(0),
- rep_(NULL) {
+ ptr_(NULL) {
int reserve = internal::CalculateReserve(begin, end);
if (reserve != -1) {
Reserve(reserve);
@@ -1086,9 +1087,9 @@ RepeatedField<Element>::RepeatedField(Iter begin, const Iter& end)
template <typename Element>
RepeatedField<Element>::~RepeatedField() {
- // See explanation in Reserve(): we need to invoke destructors here for the
- // case that Element has a non-trivial destructor.
- InternalDeallocate(rep_, total_size_);
+ if (total_size_ > 0) {
+ InternalDeallocate(rep(), total_size_);
+ }
}
template <typename Element>
@@ -1148,19 +1149,21 @@ inline int RepeatedField<Element>::Capacity() const {
template<typename Element>
inline void RepeatedField<Element>::AddAlreadyReserved(const Element& value) {
GOOGLE_DCHECK_LT(current_size_, total_size_);
- rep_->elements[current_size_++] = value;
+ rep()->elements[current_size_++] = value;
}
template<typename Element>
inline Element* RepeatedField<Element>::AddAlreadyReserved() {
GOOGLE_DCHECK_LT(current_size_, total_size_);
- return &rep_->elements[current_size_++];
+ return &rep()->elements[current_size_++];
}
template<typename Element>
inline Element* RepeatedField<Element>::AddNAlreadyReserved(int elements) {
GOOGLE_DCHECK_LE(current_size_ + elements, total_size_);
- Element* ret = &rep_->elements[current_size_];
+ // Warning: total_size_ can be NULL if elements == 0 && current_size_ == 0.
+ // Existing callers depend on this behavior. :(
+ Element* ret = &ptr_.rep->elements[current_size_];
current_size_ += elements;
return ret;
}
@@ -1170,8 +1173,8 @@ inline void RepeatedField<Element>::Resize(int new_size, const Element& value) {
GOOGLE_DCHECK_GE(new_size, 0);
if (new_size > current_size_) {
Reserve(new_size);
- std::fill(&rep_->elements[current_size_],
- &rep_->elements[new_size], value);
+ std::fill(&rep()->elements[current_size_],
+ &rep()->elements[new_size], value);
}
current_size_ = new_size;
}
@@ -1180,33 +1183,33 @@ template <typename Element>
inline const Element& RepeatedField<Element>::Get(int index) const {
GOOGLE_DCHECK_GE(index, 0);
GOOGLE_DCHECK_LT(index, current_size_);
- return rep_->elements[index];
+ return rep()->elements[index];
}
template <typename Element>
inline Element* RepeatedField<Element>::Mutable(int index) {
GOOGLE_DCHECK_GE(index, 0);
GOOGLE_DCHECK_LT(index, current_size_);
- return &rep_->elements[index];
+ return &rep()->elements[index];
}
template <typename Element>
inline void RepeatedField<Element>::Set(int index, const Element& value) {
GOOGLE_DCHECK_GE(index, 0);
GOOGLE_DCHECK_LT(index, current_size_);
- rep_->elements[index] = value;
+ rep()->elements[index] = value;
}
template <typename Element>
inline void RepeatedField<Element>::Add(const Element& value) {
if (current_size_ == total_size_) Reserve(total_size_ + 1);
- rep_->elements[current_size_++] = value;
+ rep()->elements[current_size_++] = value;
}
template <typename Element>
inline Element* RepeatedField<Element>::Add() {
if (current_size_ == total_size_) Reserve(total_size_ + 1);
- return &rep_->elements[current_size_++];
+ return &rep()->elements[current_size_++];
}
template <typename Element>
@@ -1245,10 +1248,10 @@ template <typename Element>
inline void RepeatedField<Element>::MergeFrom(const RepeatedField& other) {
GOOGLE_DCHECK_NE(&other, this);
if (other.current_size_ != 0) {
- Reserve(current_size_ + other.current_size_);
- CopyArray(rep_->elements + current_size_,
- other.rep_->elements, other.current_size_);
- current_size_ += other.current_size_;
+ int existing_size = size();
+ Reserve(existing_size + other.size());
+ AddNAlreadyReserved(other.size());
+ CopyArray(Mutable(existing_size), &other.Get(0), other.size());
}
}
@@ -1277,18 +1280,17 @@ inline typename RepeatedField<Element>::iterator RepeatedField<Element>::erase(
template <typename Element>
inline Element* RepeatedField<Element>::mutable_data() {
- return rep_ ? rep_->elements : NULL;
+ return total_size_ > 0 ? rep()->elements : NULL;
}
template <typename Element>
inline const Element* RepeatedField<Element>::data() const {
- return rep_ ? rep_->elements : NULL;
+ return total_size_ > 0 ? rep()->elements : NULL;
}
template <typename Element>
inline const Element* RepeatedField<Element>::unsafe_data() const {
- GOOGLE_DCHECK(rep_);
- return rep_->elements;
+ return rep()->elements;
}
template <typename Element>
@@ -1296,7 +1298,7 @@ inline void RepeatedField<Element>::InternalSwap(RepeatedField* other) {
GOOGLE_DCHECK(this != other);
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
- std::swap(rep_, other->rep_);
+ std::swap(ptr_, other->ptr_);
std::swap(current_size_, other->current_size_);
std::swap(total_size_, other->total_size_);
}
@@ -1323,43 +1325,43 @@ void RepeatedField<Element>::UnsafeArenaSwap(RepeatedField* other) {
template <typename Element>
void RepeatedField<Element>::SwapElements(int index1, int index2) {
using std::swap; // enable ADL with fallback
- swap(rep_->elements[index1], rep_->elements[index2]);
+ swap(rep()->elements[index1], rep()->elements[index2]);
}
template <typename Element>
inline typename RepeatedField<Element>::iterator
RepeatedField<Element>::begin() {
- return rep_ ? rep_->elements : NULL;
+ return total_size_ > 0 ? rep()->elements : NULL;
}
template <typename Element>
inline typename RepeatedField<Element>::const_iterator
RepeatedField<Element>::begin() const {
- return rep_ ? rep_->elements : NULL;
+ return total_size_ > 0 ? rep()->elements : NULL;
}
template <typename Element>
inline typename RepeatedField<Element>::const_iterator
RepeatedField<Element>::cbegin() const {
- return rep_ ? rep_->elements : NULL;
+ return total_size_ > 0 ? rep()->elements : NULL;
}
template <typename Element>
inline typename RepeatedField<Element>::iterator
RepeatedField<Element>::end() {
- return rep_ ? rep_->elements + current_size_ : NULL;
+ return total_size_ > 0 ? rep()->elements + current_size_ : NULL;
}
template <typename Element>
inline typename RepeatedField<Element>::const_iterator
RepeatedField<Element>::end() const {
- return rep_ ? rep_->elements + current_size_ : NULL;
+ return total_size_ > 0 ? rep()->elements + current_size_ : NULL;
}
template <typename Element>
inline typename RepeatedField<Element>::const_iterator
RepeatedField<Element>::cend() const {
- return rep_ ? rep_->elements + current_size_ : NULL;
+ return total_size_ > 0 ? rep()->elements + current_size_ : NULL;
}
template <typename Element>
inline size_t RepeatedField<Element>::SpaceUsedExcludingSelfLong() const {
- return rep_ ? (total_size_ * sizeof(Element) + kRepHeaderSize) : 0;
+ return total_size_ > 0 ? (total_size_ * sizeof(Element) + kRepHeaderSize) : 0;
}
// Avoid inlining of Reserve(): new, copy, and delete[] lead to a significant
@@ -1367,7 +1369,7 @@ inline size_t RepeatedField<Element>::SpaceUsedExcludingSelfLong() const {
template <typename Element>
void RepeatedField<Element>::Reserve(int new_size) {
if (total_size_ >= new_size) return;
- Rep* old_rep = rep_;
+ Rep* old_rep = total_size_ > 0 ? rep() : NULL;
Arena* arena = GetArenaNoVirtual();
new_size = std::max(google::protobuf::internal::kMinRepeatedFieldAllocationSize,
std::max(total_size_ * 2, new_size));
@@ -1377,12 +1379,12 @@ void RepeatedField<Element>::Reserve(int new_size) {
<< "Requested size is too large to fit into size_t.";
size_t bytes = kRepHeaderSize + sizeof(Element) * static_cast<size_t>(new_size);
if (arena == NULL) {
- rep_ = static_cast<Rep*>(::operator new(bytes));
+ ptr_.rep = static_cast<Rep*>(::operator new(bytes));
} else {
- rep_ = reinterpret_cast<Rep*>(
+ ptr_.rep = reinterpret_cast<Rep*>(
::google::protobuf::Arena::CreateArray<char>(arena, bytes));
}
- rep_->arena = arena;
+ ptr_.rep->arena = arena;
int old_total_size = total_size_;
total_size_ = new_size;
// Invoke placement-new on newly allocated elements. We shouldn't have to do
@@ -1394,13 +1396,13 @@ void RepeatedField<Element>::Reserve(int new_size) {
// effect unless its side-effects are required for correctness.
// Note that we do this before MoveArray() below because Element's copy
// assignment implementation will want an initialized instance first.
- Element* e = &rep_->elements[0];
- Element* limit = &rep_->elements[total_size_];
+ Element* e = &rep()->elements[0];
+ Element* limit = e + total_size_;
for (; e < limit; e++) {
new (e) Element;
}
if (current_size_ > 0) {
- MoveArray(rep_->elements, old_rep->elements, current_size_);
+ MoveArray(&rep()->elements[0], old_rep->elements, current_size_);
}
// Likewise, we need to invoke destructors on the old array.
@@ -1516,14 +1518,13 @@ inline int RepeatedPtrFieldBase::size() const {
}
template <typename TypeHandler>
-inline const typename TypeHandler::Type&
+inline const typename TypeHandler::WeakType&
RepeatedPtrFieldBase::Get(int index) const {
GOOGLE_DCHECK_GE(index, 0);
GOOGLE_DCHECK_LT(index, current_size_);
return *cast<TypeHandler>(rep_->elements[index]);
}
-
template <typename TypeHandler>
inline typename TypeHandler::Type*
RepeatedPtrFieldBase::Mutable(int index) {
@@ -1632,18 +1633,18 @@ void RepeatedPtrFieldBase::MergeFromInnerLoop(
// to avoid a branch within the loop.
for (int i = 0; i < already_allocated && i < length; i++) {
// Already allocated: use existing element.
- typename TypeHandler::Type* other_elem =
- reinterpret_cast<typename TypeHandler::Type*>(other_elems[i]);
- typename TypeHandler::Type* new_elem =
- reinterpret_cast<typename TypeHandler::Type*>(our_elems[i]);
+ typename TypeHandler::WeakType* other_elem =
+ reinterpret_cast<typename TypeHandler::WeakType*>(other_elems[i]);
+ typename TypeHandler::WeakType* new_elem =
+ reinterpret_cast<typename TypeHandler::WeakType*>(our_elems[i]);
TypeHandler::Merge(*other_elem, new_elem);
}
Arena* arena = GetArenaNoVirtual();
for (int i = already_allocated; i < length; i++) {
// Not allocated: alloc a new element first, then merge it.
- typename TypeHandler::Type* other_elem =
- reinterpret_cast<typename TypeHandler::Type*>(other_elems[i]);
- typename TypeHandler::Type* new_elem =
+ typename TypeHandler::WeakType* other_elem =
+ reinterpret_cast<typename TypeHandler::WeakType*>(other_elems[i]);
+ typename TypeHandler::WeakType* new_elem =
TypeHandler::NewFromPrototype(other_elem, arena);
TypeHandler::Merge(*other_elem, new_elem);
our_elems[i] = new_elem;
diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc
index 4a290e1e..b9d8f3cb 100644
--- a/src/google/protobuf/source_context.pb.cc
+++ b/src/google/protobuf/source_context.pb.cc
@@ -175,13 +175,6 @@ const SourceContext& SourceContext::default_instance() {
return *internal_default_instance();
}
-SourceContext* SourceContext::New(::google::protobuf::Arena* arena) const {
- SourceContext* n = new SourceContext;
- if (arena != NULL) {
- arena->Own(n);
- }
- return n;
-}
void SourceContext::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.SourceContext)
@@ -377,5 +370,12 @@ void SourceContext::InternalSwap(SourceContext* other) {
// @@protoc_insertion_point(namespace_scope)
} // namespace protobuf
} // namespace google
+namespace google {
+namespace protobuf {
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::SourceContext* Arena::Create< ::google::protobuf::SourceContext >(Arena* arena) {
+ return Arena::CreateInternal< ::google::protobuf::SourceContext >(arena);
+}
+} // namespace protobuf
+} // namespace google
// @@protoc_insertion_point(global_scope)
diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h
index dfa2444c..81893b1a 100644
--- a/src/google/protobuf/source_context.pb.h
+++ b/src/google/protobuf/source_context.pb.h
@@ -1,8 +1,8 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/source_context.proto
-#ifndef PROTOBUF_google_2fprotobuf_2fsource_5fcontext_2eproto__INCLUDED
-#define PROTOBUF_google_2fprotobuf_2fsource_5fcontext_2eproto__INCLUDED
+#ifndef PROTOBUF_google_2fprotobuf_2fsource_5fcontext_2eproto_INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fsource_5fcontext_2eproto_INCLUDED
#include <string>
@@ -57,6 +57,11 @@ LIBPROTOBUF_EXPORT extern SourceContextDefaultTypeInternal _SourceContext_defaul
} // namespace google
namespace google {
namespace protobuf {
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::SourceContext* Arena::Create< ::google::protobuf::SourceContext>(Arena*);
+} // namespace protobuf
+} // namespace google
+namespace google {
+namespace protobuf {
// ===================================================================
@@ -104,9 +109,13 @@ class LIBPROTOBUF_EXPORT SourceContext : public ::google::protobuf::Message /* @
// implements Message ----------------------------------------------
- inline SourceContext* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline SourceContext* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<SourceContext>(NULL);
+ }
- SourceContext* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ SourceContext* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::Create<SourceContext>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const SourceContext& from);
@@ -240,4 +249,4 @@ inline void SourceContext::set_allocated_file_name(::std::string* file_name) {
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_google_2fprotobuf_2fsource_5fcontext_2eproto__INCLUDED
+#endif // PROTOBUF_google_2fprotobuf_2fsource_5fcontext_2eproto_INCLUDED
diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc
index fe3ba327..309a4d2d 100644
--- a/src/google/protobuf/struct.pb.cc
+++ b/src/google/protobuf/struct.pb.cc
@@ -298,9 +298,6 @@ const Struct& Struct::default_instance() {
return *internal_default_instance();
}
-Struct* Struct::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<Struct>(arena);
-}
void Struct::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Struct)
@@ -762,9 +759,6 @@ const Value& Value::default_instance() {
return *internal_default_instance();
}
-Value* Value::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<Value>(arena);
-}
void Value::clear_kind() {
// @@protoc_insertion_point(one_of_clear_start:google.protobuf.Value)
@@ -1268,9 +1262,6 @@ const ListValue& ListValue::default_instance() {
return *internal_default_instance();
}
-ListValue* ListValue::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<ListValue>(arena);
-}
void ListValue::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.ListValue)
@@ -1296,7 +1287,8 @@ bool ListValue::MergePartialFromCodedStream(
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_values()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_values()));
} else {
goto handle_unusual;
}
@@ -1333,7 +1325,9 @@ void ListValue::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->values_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 1, this->values(static_cast<int>(i)), output);
+ 1,
+ this->values(static_cast<int>(i)),
+ output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
@@ -1457,7 +1451,7 @@ void ListValue::UnsafeArenaSwap(ListValue* other) {
}
void ListValue::InternalSwap(ListValue* other) {
using std::swap;
- values_.InternalSwap(&other->values_);
+ CastToBase(&values_)->InternalSwap(CastToBase(&other->values_));
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
@@ -1471,5 +1465,21 @@ void ListValue::InternalSwap(ListValue* other) {
// @@protoc_insertion_point(namespace_scope)
} // namespace protobuf
} // namespace google
+namespace google {
+namespace protobuf {
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Struct_FieldsEntry_DoNotUse* Arena::CreateMessage< ::google::protobuf::Struct_FieldsEntry_DoNotUse >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::Struct_FieldsEntry_DoNotUse >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Struct* Arena::CreateMessage< ::google::protobuf::Struct >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::Struct >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Value* Arena::CreateMessage< ::google::protobuf::Value >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::Value >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::ListValue* Arena::CreateMessage< ::google::protobuf::ListValue >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::ListValue >(arena);
+}
+} // namespace protobuf
+} // namespace google
// @@protoc_insertion_point(global_scope)
diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h
index cdc00dcd..91aa3cf2 100644
--- a/src/google/protobuf/struct.pb.h
+++ b/src/google/protobuf/struct.pb.h
@@ -1,8 +1,8 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/struct.proto
-#ifndef PROTOBUF_google_2fprotobuf_2fstruct_2eproto__INCLUDED
-#define PROTOBUF_google_2fprotobuf_2fstruct_2eproto__INCLUDED
+#ifndef PROTOBUF_google_2fprotobuf_2fstruct_2eproto_INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fstruct_2eproto_INCLUDED
#include <string>
@@ -70,6 +70,14 @@ LIBPROTOBUF_EXPORT extern ValueDefaultTypeInternal _Value_default_instance_;
} // namespace google
namespace google {
namespace protobuf {
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::ListValue* Arena::CreateMessage< ::google::protobuf::ListValue>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Struct* Arena::CreateMessage< ::google::protobuf::Struct>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Struct_FieldsEntry_DoNotUse* Arena::CreateMessage< ::google::protobuf::Struct_FieldsEntry_DoNotUse>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Value* Arena::CreateMessage< ::google::protobuf::Value>(Arena*);
+} // namespace protobuf
+} // namespace google
+namespace google {
+namespace protobuf {
enum NullValue {
NULL_VALUE = 0,
@@ -165,9 +173,13 @@ class LIBPROTOBUF_EXPORT Struct : public ::google::protobuf::Message /* @@protoc
// implements Message ----------------------------------------------
- inline Struct* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Struct* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Struct>(NULL);
+ }
- Struct* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Struct* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Struct>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Struct& from);
@@ -298,9 +310,13 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_
// implements Message ----------------------------------------------
- inline Value* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Value* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Value>(NULL);
+ }
- Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Value>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Value& from);
@@ -398,9 +414,6 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_
bool has_struct_value() const;
void clear_struct_value();
static const int kStructValueFieldNumber = 5;
- private:
- void _slow_mutable_struct_value();
- public:
const ::google::protobuf::Struct& struct_value() const;
::google::protobuf::Struct* release_struct_value();
::google::protobuf::Struct* mutable_struct_value();
@@ -413,9 +426,6 @@ class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_
bool has_list_value() const;
void clear_list_value();
static const int kListValueFieldNumber = 6;
- private:
- void _slow_mutable_list_value();
- public:
const ::google::protobuf::ListValue& list_value() const;
::google::protobuf::ListValue* release_list_value();
::google::protobuf::ListValue* mutable_list_value();
@@ -510,9 +520,13 @@ class LIBPROTOBUF_EXPORT ListValue : public ::google::protobuf::Message /* @@pro
// implements Message ----------------------------------------------
- inline ListValue* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline ListValue* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<ListValue>(NULL);
+ }
- ListValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ ListValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<ListValue>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const ListValue& from);
@@ -557,11 +571,11 @@ class LIBPROTOBUF_EXPORT ListValue : public ::google::protobuf::Message /* @@pro
int values_size() const;
void clear_values();
static const int kValuesFieldNumber = 1;
- const ::google::protobuf::Value& values(int index) const;
::google::protobuf::Value* mutable_values(int index);
- ::google::protobuf::Value* add_values();
::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >*
mutable_values();
+ const ::google::protobuf::Value& values(int index) const;
+ ::google::protobuf::Value* add_values();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >&
values() const;
@@ -881,9 +895,8 @@ inline ::google::protobuf::Struct* Value::mutable_struct_value() {
if (!has_struct_value()) {
clear_kind();
set_has_struct_value();
- kind_.struct_value_ =
- ::google::protobuf::Arena::CreateMessage< ::google::protobuf::Struct >(
- GetArenaNoVirtual());
+ kind_.struct_value_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::Struct >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value)
return kind_.struct_value_;
@@ -947,9 +960,8 @@ inline ::google::protobuf::ListValue* Value::mutable_list_value() {
if (!has_list_value()) {
clear_kind();
set_has_list_value();
- kind_.list_value_ =
- ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ListValue >(
- GetArenaNoVirtual());
+ kind_.list_value_ = ::google::protobuf::Arena::CreateMessage< ::google::protobuf::ListValue >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value)
return kind_.list_value_;
@@ -975,23 +987,23 @@ inline int ListValue::values_size() const {
inline void ListValue::clear_values() {
values_.Clear();
}
-inline const ::google::protobuf::Value& ListValue::values(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.ListValue.values)
- return values_.Get(index);
-}
inline ::google::protobuf::Value* ListValue::mutable_values(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.ListValue.values)
return values_.Mutable(index);
}
-inline ::google::protobuf::Value* ListValue::add_values() {
- // @@protoc_insertion_point(field_add:google.protobuf.ListValue.values)
- return values_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >*
ListValue::mutable_values() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.ListValue.values)
return &values_;
}
+inline const ::google::protobuf::Value& ListValue::values(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.ListValue.values)
+ return values_.Get(index);
+}
+inline ::google::protobuf::Value* ListValue::add_values() {
+ // @@protoc_insertion_point(field_add:google.protobuf.ListValue.values)
+ return values_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >&
ListValue::values() const {
// @@protoc_insertion_point(field_list:google.protobuf.ListValue.values)
@@ -1027,4 +1039,4 @@ inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::NullValue>()
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_google_2fprotobuf_2fstruct_2eproto__INCLUDED
+#endif // PROTOBUF_google_2fprotobuf_2fstruct_2eproto_INCLUDED
diff --git a/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h b/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
index 0b0b06ce..075c406a 100644
--- a/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
+++ b/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
@@ -146,6 +146,14 @@ inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
return __atomic_load_n(ptr, __ATOMIC_RELAXED);
}
+inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value,
+ Atomic64 new_value) {
+ __atomic_compare_exchange_n(ptr, &old_value, new_value, false,
+ __ATOMIC_RELEASE, __ATOMIC_ACQUIRE);
+ return old_value;
+}
+
#endif // defined(__LP64__)
} // namespace internal
diff --git a/src/google/protobuf/stubs/io_win32.cc b/src/google/protobuf/stubs/io_win32.cc
index b59b8e48..5ead98c8 100644
--- a/src/google/protobuf/stubs/io_win32.cc
+++ b/src/google/protobuf/stubs/io_win32.cc
@@ -151,12 +151,13 @@ wstring normalize(wstring path) {
static const wstring dot(L".");
static const wstring dotdot(L"..");
+ const WCHAR* p = path.c_str();
std::vector<wstring> segments;
int segment_start = -1;
// Find the path segments in `path` (separated by "/").
for (int i = 0;; ++i) {
- if (!is_separator(path[i]) && path[i] != L'\0') {
+ if (!is_separator(p[i]) && p[i] != L'\0') {
// The current character does not end a segment, so start one unless it's
// already started.
if (segment_start < 0) {
@@ -165,7 +166,7 @@ wstring normalize(wstring path) {
} else if (segment_start >= 0 && i > segment_start) {
// The current character is "/" or "\0", so this ends a segment.
// Add that to `segments` if there's anything to add; handle "." and "..".
- wstring segment(path, segment_start, i - segment_start);
+ wstring segment(p, segment_start, i - segment_start);
segment_start = -1;
if (segment == dotdot) {
if (!segments.empty() &&
@@ -176,7 +177,7 @@ wstring normalize(wstring path) {
segments.push_back(segment);
}
}
- if (path[i] == L'\0') {
+ if (p[i] == L'\0') {
break;
}
}
@@ -199,7 +200,7 @@ wstring normalize(wstring path) {
result << segments[i];
}
// Preserve trailing separator if the input contained it.
- if (!path.empty() && is_separator(path[path.size() - 1])) {
+ if (!path.empty() && is_separator(p[path.size() - 1])) {
result << L'\\';
}
return result.str();
diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h
index cecefdcb..30bd7b1d 100644
--- a/src/google/protobuf/stubs/port.h
+++ b/src/google/protobuf/stubs/port.h
@@ -348,6 +348,13 @@ inline void GOOGLE_UNALIGNED_STORE64(void *p, uint64 v) {
}
#endif
+#if defined(GOOGLE_PROTOBUF_OS_NACL) \
+ || (defined(__ANDROID__) && defined(__clang__) \
+ && (__clang_major__ == 3 && __clang_minor__ == 8) \
+ && (__clang_patchlevel__ < 275480))
+# define GOOGLE_PROTOBUF_USE_PORTABLE_LOG2
+#endif
+
#if defined(_MSC_VER)
#define GOOGLE_THREAD_LOCAL __declspec(thread)
#else
@@ -413,12 +420,13 @@ class Bits {
}
static uint32 Log2FloorNonZero64(uint64 n) {
- // arm-nacl-clang runs into an instruction-selection failure when it
- // encounters __builtin_clzll:
+ // Older versions of clang run into an instruction-selection failure when
+ // it encounters __builtin_clzll:
// https://bugs.chromium.org/p/nativeclient/issues/detail?id=4395
- // To work around this, when we build for NaCl we use the portable
+ // This includes arm-nacl-clang and clang in older Android NDK versions.
+ // To work around this, when we build with those we use the portable
// implementation instead.
-#if defined(__GNUC__) && !defined(GOOGLE_PROTOBUF_OS_NACL)
+#if defined(__GNUC__) && !defined(GOOGLE_PROTOBUF_USE_PORTABLE_LOG2)
return 63 ^ static_cast<uint32>(__builtin_clzll(n));
#else
return Log2FloorNonZero64_Portable(n);
diff --git a/src/google/protobuf/stubs/structurally_valid.cc b/src/google/protobuf/stubs/structurally_valid.cc
index d79a6ee4..b2239682 100644
--- a/src/google/protobuf/stubs/structurally_valid.cc
+++ b/src/google/protobuf/stubs/structurally_valid.cc
@@ -1,4 +1,33 @@
-// Copyright 2005-2008 Google Inc. All Rights Reserved.
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc. All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
// Author: jrm@google.com (Jim Meehan)
#include <google/protobuf/stubs/common.h>
diff --git a/src/google/protobuf/stubs/structurally_valid_unittest.cc b/src/google/protobuf/stubs/structurally_valid_unittest.cc
index 90888885..eec07a87 100644
--- a/src/google/protobuf/stubs/structurally_valid_unittest.cc
+++ b/src/google/protobuf/stubs/structurally_valid_unittest.cc
@@ -1,3 +1,33 @@
+// 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.
+
// Copyright 2008 Google Inc. All Rights Reserved.
// Author: xpeng@google.com (Peter Peng)
diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc
index 36e3bb36..f57d4d66 100644
--- a/src/google/protobuf/timestamp.pb.cc
+++ b/src/google/protobuf/timestamp.pb.cc
@@ -191,9 +191,6 @@ const Timestamp& Timestamp::default_instance() {
return *internal_default_instance();
}
-Timestamp* Timestamp::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<Timestamp>(arena);
-}
void Timestamp::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Timestamp)
@@ -427,5 +424,12 @@ void Timestamp::InternalSwap(Timestamp* other) {
// @@protoc_insertion_point(namespace_scope)
} // namespace protobuf
} // namespace google
+namespace google {
+namespace protobuf {
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Timestamp* Arena::CreateMessage< ::google::protobuf::Timestamp >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::Timestamp >(arena);
+}
+} // namespace protobuf
+} // namespace google
// @@protoc_insertion_point(global_scope)
diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h
index 6c7136e2..a0f9605c 100644
--- a/src/google/protobuf/timestamp.pb.h
+++ b/src/google/protobuf/timestamp.pb.h
@@ -1,8 +1,8 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/timestamp.proto
-#ifndef PROTOBUF_google_2fprotobuf_2ftimestamp_2eproto__INCLUDED
-#define PROTOBUF_google_2fprotobuf_2ftimestamp_2eproto__INCLUDED
+#ifndef PROTOBUF_google_2fprotobuf_2ftimestamp_2eproto_INCLUDED
+#define PROTOBUF_google_2fprotobuf_2ftimestamp_2eproto_INCLUDED
#include <string>
@@ -57,6 +57,11 @@ LIBPROTOBUF_EXPORT extern TimestampDefaultTypeInternal _Timestamp_default_instan
} // namespace google
namespace google {
namespace protobuf {
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Timestamp* Arena::CreateMessage< ::google::protobuf::Timestamp>(Arena*);
+} // namespace protobuf
+} // namespace google
+namespace google {
+namespace protobuf {
// ===================================================================
@@ -111,9 +116,13 @@ class LIBPROTOBUF_EXPORT Timestamp : public ::google::protobuf::Message /* @@pro
// implements Message ----------------------------------------------
- inline Timestamp* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Timestamp* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Timestamp>(NULL);
+ }
- Timestamp* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Timestamp* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Timestamp>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Timestamp& from);
@@ -229,4 +238,4 @@ inline void Timestamp::set_nanos(::google::protobuf::int32 value) {
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_google_2fprotobuf_2ftimestamp_2eproto__INCLUDED
+#endif // PROTOBUF_google_2fprotobuf_2ftimestamp_2eproto_INCLUDED
diff --git a/src/google/protobuf/timestamp.proto b/src/google/protobuf/timestamp.proto
index 06750ab1..eafb3fa0 100644
--- a/src/google/protobuf/timestamp.proto
+++ b/src/google/protobuf/timestamp.proto
@@ -103,7 +103,9 @@ option objc_class_prefix = "GPB";
// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
-// is required, though only UTC (as indicated by "Z") is presently supported.
+// is required. A proto3 JSON serializer should always use UTC (as indicated by
+// "Z") when printing the Timestamp type and a proto3 JSON parser should be
+// able to accept both UTC and other timezones (as indicated by an offset).
//
// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
// 01:30 UTC on January 15, 2017.
@@ -114,8 +116,8 @@ option objc_class_prefix = "GPB";
// to this format using [`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--)
-// to obtain a formatter capable of generating timestamps in this format.
+// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
+// ) to obtain a formatter capable of generating timestamps in this format.
//
//
message Timestamp {
diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc
index 92f6589c..a2edabb6 100644
--- a/src/google/protobuf/type.pb.cc
+++ b/src/google/protobuf/type.pb.cc
@@ -420,10 +420,6 @@ void Type::InitAsDefaultInstance() {
::google::protobuf::_Type_default_instance_._instance.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>(
::google::protobuf::SourceContext::internal_default_instance());
}
-void Type::_slow_mutable_source_context() {
- source_context_ = ::google::protobuf::Arena::Create< ::google::protobuf::SourceContext >(
- GetArenaNoVirtual());
-}
void Type::unsafe_arena_set_allocated_source_context(
::google::protobuf::SourceContext* source_context) {
if (GetArenaNoVirtual() == NULL) {
@@ -533,9 +529,6 @@ const Type& Type::default_instance() {
return *internal_default_instance();
}
-Type* Type::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<Type>(arena);
-}
void Type::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Type)
@@ -585,7 +578,8 @@ bool Type::MergePartialFromCodedStream(
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_fields()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_fields()));
} else {
goto handle_unusual;
}
@@ -613,7 +607,8 @@ bool Type::MergePartialFromCodedStream(
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_options()));
} else {
goto handle_unusual;
}
@@ -687,7 +682,9 @@ void Type::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->fields_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 2, this->fields(static_cast<int>(i)), output);
+ 2,
+ this->fields(static_cast<int>(i)),
+ output);
}
// repeated string oneofs = 3;
@@ -704,13 +701,15 @@ void Type::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 4, this->options(static_cast<int>(i)), output);
+ 4,
+ this->options(static_cast<int>(i)),
+ output);
}
// .google.protobuf.SourceContext source_context = 5;
if (this->has_source_context()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 5, *this->source_context_, output);
+ 5, *source_context_, output);
}
// .google.protobuf.Syntax syntax = 6;
@@ -774,7 +773,7 @@ void Type::SerializeWithCachedSizes(
if (this->has_source_context()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 5, *this->source_context_, deterministic, target);
+ 5, *source_context_, deterministic, target);
}
// .google.protobuf.Syntax syntax = 6;
@@ -841,7 +840,7 @@ size_t Type::ByteSizeLong() const {
if (this->has_source_context()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->source_context_);
+ *source_context_);
}
// .google.protobuf.Syntax syntax = 6;
@@ -932,9 +931,9 @@ void Type::UnsafeArenaSwap(Type* other) {
}
void Type::InternalSwap(Type* other) {
using std::swap;
- fields_.InternalSwap(&other->fields_);
- oneofs_.InternalSwap(&other->oneofs_);
- options_.InternalSwap(&other->options_);
+ CastToBase(&fields_)->InternalSwap(CastToBase(&other->fields_));
+ oneofs_.InternalSwap(CastToBase(&other->oneofs_));
+ CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
name_.Swap(&other->name_);
swap(source_context_, other->source_context_);
swap(syntax_, other->syntax_);
@@ -1059,9 +1058,6 @@ const Field& Field::default_instance() {
return *internal_default_instance();
}
-Field* Field::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<Field>(arena);
-}
void Field::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Field)
@@ -1198,7 +1194,8 @@ bool Field::MergePartialFromCodedStream(
case 9: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(74u /* 74 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_options()));
} else {
goto handle_unusual;
}
@@ -1314,7 +1311,9 @@ void Field::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 9, this->options(static_cast<int>(i)), output);
+ 9,
+ this->options(static_cast<int>(i)),
+ output);
}
// string json_name = 10;
@@ -1615,7 +1614,7 @@ void Field::UnsafeArenaSwap(Field* other) {
}
void Field::InternalSwap(Field* other) {
using std::swap;
- options_.InternalSwap(&other->options_);
+ CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
name_.Swap(&other->name_);
type_url_.Swap(&other->type_url_);
json_name_.Swap(&other->json_name_);
@@ -1641,10 +1640,6 @@ void Enum::InitAsDefaultInstance() {
::google::protobuf::_Enum_default_instance_._instance.get_mutable()->source_context_ = const_cast< ::google::protobuf::SourceContext*>(
::google::protobuf::SourceContext::internal_default_instance());
}
-void Enum::_slow_mutable_source_context() {
- source_context_ = ::google::protobuf::Arena::Create< ::google::protobuf::SourceContext >(
- GetArenaNoVirtual());
-}
void Enum::unsafe_arena_set_allocated_source_context(
::google::protobuf::SourceContext* source_context) {
if (GetArenaNoVirtual() == NULL) {
@@ -1751,9 +1746,6 @@ const Enum& Enum::default_instance() {
return *internal_default_instance();
}
-Enum* Enum::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<Enum>(arena);
-}
void Enum::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Enum)
@@ -1802,7 +1794,8 @@ bool Enum::MergePartialFromCodedStream(
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_enumvalue()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_enumvalue()));
} else {
goto handle_unusual;
}
@@ -1813,7 +1806,8 @@ bool Enum::MergePartialFromCodedStream(
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_options()));
} else {
goto handle_unusual;
}
@@ -1887,20 +1881,24 @@ void Enum::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->enumvalue_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 2, this->enumvalue(static_cast<int>(i)), output);
+ 2,
+ this->enumvalue(static_cast<int>(i)),
+ output);
}
// repeated .google.protobuf.Option options = 3;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 3, this->options(static_cast<int>(i)), output);
+ 3,
+ this->options(static_cast<int>(i)),
+ output);
}
// .google.protobuf.SourceContext source_context = 4;
if (this->has_source_context()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 4, *this->source_context_, output);
+ 4, *source_context_, output);
}
// .google.protobuf.Syntax syntax = 5;
@@ -1954,7 +1952,7 @@ void Enum::SerializeWithCachedSizes(
if (this->has_source_context()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 4, *this->source_context_, deterministic, target);
+ 4, *source_context_, deterministic, target);
}
// .google.protobuf.Syntax syntax = 5;
@@ -2013,7 +2011,7 @@ size_t Enum::ByteSizeLong() const {
if (this->has_source_context()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->source_context_);
+ *source_context_);
}
// .google.protobuf.Syntax syntax = 5;
@@ -2103,8 +2101,8 @@ void Enum::UnsafeArenaSwap(Enum* other) {
}
void Enum::InternalSwap(Enum* other) {
using std::swap;
- enumvalue_.InternalSwap(&other->enumvalue_);
- options_.InternalSwap(&other->options_);
+ CastToBase(&enumvalue_)->InternalSwap(CastToBase(&other->enumvalue_));
+ CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
name_.Swap(&other->name_);
swap(source_context_, other->source_context_);
swap(syntax_, other->syntax_);
@@ -2197,9 +2195,6 @@ const EnumValue& EnumValue::default_instance() {
return *internal_default_instance();
}
-EnumValue* EnumValue::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<EnumValue>(arena);
-}
void EnumValue::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValue)
@@ -2257,7 +2252,8 @@ bool EnumValue::MergePartialFromCodedStream(
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options()));
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
+ input, add_options()));
} else {
goto handle_unusual;
}
@@ -2309,7 +2305,9 @@ void EnumValue::SerializeWithCachedSizes(
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->options_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 3, this->options(static_cast<int>(i)), output);
+ 3,
+ this->options(static_cast<int>(i)),
+ output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
@@ -2469,7 +2467,7 @@ void EnumValue::UnsafeArenaSwap(EnumValue* other) {
}
void EnumValue::InternalSwap(EnumValue* other) {
using std::swap;
- options_.InternalSwap(&other->options_);
+ CastToBase(&options_)->InternalSwap(CastToBase(&other->options_));
name_.Swap(&other->name_);
swap(number_, other->number_);
_internal_metadata_.Swap(&other->_internal_metadata_);
@@ -2488,10 +2486,6 @@ void Option::InitAsDefaultInstance() {
::google::protobuf::_Option_default_instance_._instance.get_mutable()->value_ = const_cast< ::google::protobuf::Any*>(
::google::protobuf::Any::internal_default_instance());
}
-void Option::_slow_mutable_value() {
- value_ = ::google::protobuf::Arena::Create< ::google::protobuf::Any >(
- GetArenaNoVirtual());
-}
void Option::unsafe_arena_set_allocated_value(
::google::protobuf::Any* value) {
if (GetArenaNoVirtual() == NULL) {
@@ -2588,9 +2582,6 @@ const Option& Option::default_instance() {
return *internal_default_instance();
}
-Option* Option::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<Option>(arena);
-}
void Option::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Option)
@@ -2683,7 +2674,7 @@ void Option::SerializeWithCachedSizes(
// .google.protobuf.Any value = 2;
if (this->has_value()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
- 2, *this->value_, output);
+ 2, *value_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
@@ -2715,7 +2706,7 @@ void Option::SerializeWithCachedSizes(
if (this->has_value()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
- 2, *this->value_, deterministic, target);
+ 2, *value_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
@@ -2746,7 +2737,7 @@ size_t Option::ByteSizeLong() const {
if (this->has_value()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
- *this->value_);
+ *value_);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
@@ -2840,5 +2831,24 @@ void Option::InternalSwap(Option* other) {
// @@protoc_insertion_point(namespace_scope)
} // namespace protobuf
} // namespace google
+namespace google {
+namespace protobuf {
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Type* Arena::CreateMessage< ::google::protobuf::Type >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::Type >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Field* Arena::CreateMessage< ::google::protobuf::Field >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::Field >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Enum* Arena::CreateMessage< ::google::protobuf::Enum >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::Enum >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::EnumValue* Arena::CreateMessage< ::google::protobuf::EnumValue >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::EnumValue >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Option* Arena::CreateMessage< ::google::protobuf::Option >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::Option >(arena);
+}
+} // namespace protobuf
+} // namespace google
// @@protoc_insertion_point(global_scope)
diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h
index 8ee74a12..49bed8ee 100644
--- a/src/google/protobuf/type.pb.h
+++ b/src/google/protobuf/type.pb.h
@@ -1,8 +1,8 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/type.proto
-#ifndef PROTOBUF_google_2fprotobuf_2ftype_2eproto__INCLUDED
-#define PROTOBUF_google_2fprotobuf_2ftype_2eproto__INCLUDED
+#ifndef PROTOBUF_google_2fprotobuf_2ftype_2eproto_INCLUDED
+#define PROTOBUF_google_2fprotobuf_2ftype_2eproto_INCLUDED
#include <string>
@@ -84,6 +84,15 @@ LIBPROTOBUF_EXPORT extern TypeDefaultTypeInternal _Type_default_instance_;
} // namespace google
namespace google {
namespace protobuf {
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Enum* Arena::CreateMessage< ::google::protobuf::Enum>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::EnumValue* Arena::CreateMessage< ::google::protobuf::EnumValue>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Field* Arena::CreateMessage< ::google::protobuf::Field>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Option* Arena::CreateMessage< ::google::protobuf::Option>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Type* Arena::CreateMessage< ::google::protobuf::Type>(Arena*);
+} // namespace protobuf
+} // namespace google
+namespace google {
+namespace protobuf {
enum Field_Kind {
Field_Kind_TYPE_UNKNOWN = 0,
@@ -220,9 +229,13 @@ class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_i
// implements Message ----------------------------------------------
- inline Type* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Type* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Type>(NULL);
+ }
- Type* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Type* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Type>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Type& from);
@@ -267,11 +280,11 @@ class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_i
int fields_size() const;
void clear_fields();
static const int kFieldsFieldNumber = 2;
- const ::google::protobuf::Field& fields(int index) const;
::google::protobuf::Field* mutable_fields(int index);
- ::google::protobuf::Field* add_fields();
::google::protobuf::RepeatedPtrField< ::google::protobuf::Field >*
mutable_fields();
+ const ::google::protobuf::Field& fields(int index) const;
+ ::google::protobuf::Field* add_fields();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Field >&
fields() const;
@@ -301,11 +314,11 @@ class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_i
int options_size() const;
void clear_options();
static const int kOptionsFieldNumber = 4;
- const ::google::protobuf::Option& options(int index) const;
::google::protobuf::Option* mutable_options(int index);
- ::google::protobuf::Option* add_options();
::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
mutable_options();
+ const ::google::protobuf::Option& options(int index) const;
+ ::google::protobuf::Option* add_options();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
options() const;
@@ -336,9 +349,6 @@ class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message /* @@protoc_i
bool has_source_context() const;
void clear_source_context();
static const int kSourceContextFieldNumber = 5;
- private:
- void _slow_mutable_source_context();
- public:
const ::google::protobuf::SourceContext& source_context() const;
::google::protobuf::SourceContext* release_source_context();
::google::protobuf::SourceContext* mutable_source_context();
@@ -423,9 +433,13 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_
// implements Message ----------------------------------------------
- inline Field* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Field* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Field>(NULL);
+ }
- Field* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Field* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Field>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Field& from);
@@ -560,11 +574,11 @@ class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message /* @@protoc_
int options_size() const;
void clear_options();
static const int kOptionsFieldNumber = 9;
- const ::google::protobuf::Option& options(int index) const;
::google::protobuf::Option* mutable_options(int index);
- ::google::protobuf::Option* add_options();
::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
mutable_options();
+ const ::google::protobuf::Option& options(int index) const;
+ ::google::protobuf::Option* add_options();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
options() const;
@@ -764,9 +778,13 @@ class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_i
// implements Message ----------------------------------------------
- inline Enum* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Enum* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Enum>(NULL);
+ }
- Enum* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Enum* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Enum>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Enum& from);
@@ -811,11 +829,11 @@ class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_i
int enumvalue_size() const;
void clear_enumvalue();
static const int kEnumvalueFieldNumber = 2;
- const ::google::protobuf::EnumValue& enumvalue(int index) const;
::google::protobuf::EnumValue* mutable_enumvalue(int index);
- ::google::protobuf::EnumValue* add_enumvalue();
::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue >*
mutable_enumvalue();
+ const ::google::protobuf::EnumValue& enumvalue(int index) const;
+ ::google::protobuf::EnumValue* add_enumvalue();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue >&
enumvalue() const;
@@ -823,11 +841,11 @@ class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_i
int options_size() const;
void clear_options();
static const int kOptionsFieldNumber = 3;
- const ::google::protobuf::Option& options(int index) const;
::google::protobuf::Option* mutable_options(int index);
- ::google::protobuf::Option* add_options();
::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
mutable_options();
+ const ::google::protobuf::Option& options(int index) const;
+ ::google::protobuf::Option* add_options();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
options() const;
@@ -858,9 +876,6 @@ class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message /* @@protoc_i
bool has_source_context() const;
void clear_source_context();
static const int kSourceContextFieldNumber = 4;
- private:
- void _slow_mutable_source_context();
- public:
const ::google::protobuf::SourceContext& source_context() const;
::google::protobuf::SourceContext* release_source_context();
::google::protobuf::SourceContext* mutable_source_context();
@@ -944,9 +959,13 @@ class LIBPROTOBUF_EXPORT EnumValue : public ::google::protobuf::Message /* @@pro
// implements Message ----------------------------------------------
- inline EnumValue* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline EnumValue* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<EnumValue>(NULL);
+ }
- EnumValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ EnumValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<EnumValue>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const EnumValue& from);
@@ -991,11 +1010,11 @@ class LIBPROTOBUF_EXPORT EnumValue : public ::google::protobuf::Message /* @@pro
int options_size() const;
void clear_options();
static const int kOptionsFieldNumber = 3;
- const ::google::protobuf::Option& options(int index) const;
::google::protobuf::Option* mutable_options(int index);
- ::google::protobuf::Option* add_options();
::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
mutable_options();
+ const ::google::protobuf::Option& options(int index) const;
+ ::google::protobuf::Option* add_options();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
options() const;
@@ -1095,9 +1114,13 @@ class LIBPROTOBUF_EXPORT Option : public ::google::protobuf::Message /* @@protoc
// implements Message ----------------------------------------------
- inline Option* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Option* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Option>(NULL);
+ }
- Option* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Option* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Option>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Option& from);
@@ -1165,9 +1188,6 @@ class LIBPROTOBUF_EXPORT Option : public ::google::protobuf::Message /* @@protoc
bool has_value() const;
void clear_value();
static const int kValueFieldNumber = 2;
- private:
- void _slow_mutable_value();
- public:
const ::google::protobuf::Any& value() const;
::google::protobuf::Any* release_value();
::google::protobuf::Any* mutable_value();
@@ -1282,23 +1302,23 @@ inline int Type::fields_size() const {
inline void Type::clear_fields() {
fields_.Clear();
}
-inline const ::google::protobuf::Field& Type::fields(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.Type.fields)
- return fields_.Get(index);
-}
inline ::google::protobuf::Field* Type::mutable_fields(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.Type.fields)
return fields_.Mutable(index);
}
-inline ::google::protobuf::Field* Type::add_fields() {
- // @@protoc_insertion_point(field_add:google.protobuf.Type.fields)
- return fields_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Field >*
Type::mutable_fields() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.fields)
return &fields_;
}
+inline const ::google::protobuf::Field& Type::fields(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Type.fields)
+ return fields_.Get(index);
+}
+inline ::google::protobuf::Field* Type::add_fields() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Type.fields)
+ return fields_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Field >&
Type::fields() const {
// @@protoc_insertion_point(field_list:google.protobuf.Type.fields)
@@ -1381,23 +1401,23 @@ inline int Type::options_size() const {
inline void Type::clear_options() {
options_.Clear();
}
-inline const ::google::protobuf::Option& Type::options(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.Type.options)
- return options_.Get(index);
-}
inline ::google::protobuf::Option* Type::mutable_options(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.Type.options)
return options_.Mutable(index);
}
-inline ::google::protobuf::Option* Type::add_options() {
- // @@protoc_insertion_point(field_add:google.protobuf.Type.options)
- return options_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
Type::mutable_options() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.options)
return &options_;
}
+inline const ::google::protobuf::Option& Type::options(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Type.options)
+ return options_.Get(index);
+}
+inline ::google::protobuf::Option* Type::add_options() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Type.options)
+ return options_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
Type::options() const {
// @@protoc_insertion_point(field_list:google.protobuf.Type.options)
@@ -1434,7 +1454,8 @@ inline ::google::protobuf::SourceContext* Type::unsafe_arena_release_source_cont
inline ::google::protobuf::SourceContext* Type::mutable_source_context() {
if (source_context_ == NULL) {
- _slow_mutable_source_context();
+ source_context_ = ::google::protobuf::Arena::Create< ::google::protobuf::SourceContext >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.Type.source_context)
return source_context_;
@@ -1703,23 +1724,23 @@ inline int Field::options_size() const {
inline void Field::clear_options() {
options_.Clear();
}
-inline const ::google::protobuf::Option& Field::options(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.Field.options)
- return options_.Get(index);
-}
inline ::google::protobuf::Option* Field::mutable_options(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.Field.options)
return options_.Mutable(index);
}
-inline ::google::protobuf::Option* Field::add_options() {
- // @@protoc_insertion_point(field_add:google.protobuf.Field.options)
- return options_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
Field::mutable_options() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Field.options)
return &options_;
}
+inline const ::google::protobuf::Option& Field::options(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Field.options)
+ return options_.Get(index);
+}
+inline ::google::protobuf::Option* Field::add_options() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Field.options)
+ return options_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
Field::options() const {
// @@protoc_insertion_point(field_list:google.protobuf.Field.options)
@@ -1962,23 +1983,23 @@ inline int Enum::enumvalue_size() const {
inline void Enum::clear_enumvalue() {
enumvalue_.Clear();
}
-inline const ::google::protobuf::EnumValue& Enum::enumvalue(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.Enum.enumvalue)
- return enumvalue_.Get(index);
-}
inline ::google::protobuf::EnumValue* Enum::mutable_enumvalue(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.Enum.enumvalue)
return enumvalue_.Mutable(index);
}
-inline ::google::protobuf::EnumValue* Enum::add_enumvalue() {
- // @@protoc_insertion_point(field_add:google.protobuf.Enum.enumvalue)
- return enumvalue_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue >*
Enum::mutable_enumvalue() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.enumvalue)
return &enumvalue_;
}
+inline const ::google::protobuf::EnumValue& Enum::enumvalue(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Enum.enumvalue)
+ return enumvalue_.Get(index);
+}
+inline ::google::protobuf::EnumValue* Enum::add_enumvalue() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Enum.enumvalue)
+ return enumvalue_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue >&
Enum::enumvalue() const {
// @@protoc_insertion_point(field_list:google.protobuf.Enum.enumvalue)
@@ -1992,23 +2013,23 @@ inline int Enum::options_size() const {
inline void Enum::clear_options() {
options_.Clear();
}
-inline const ::google::protobuf::Option& Enum::options(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.Enum.options)
- return options_.Get(index);
-}
inline ::google::protobuf::Option* Enum::mutable_options(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.Enum.options)
return options_.Mutable(index);
}
-inline ::google::protobuf::Option* Enum::add_options() {
- // @@protoc_insertion_point(field_add:google.protobuf.Enum.options)
- return options_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
Enum::mutable_options() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.options)
return &options_;
}
+inline const ::google::protobuf::Option& Enum::options(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.Enum.options)
+ return options_.Get(index);
+}
+inline ::google::protobuf::Option* Enum::add_options() {
+ // @@protoc_insertion_point(field_add:google.protobuf.Enum.options)
+ return options_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
Enum::options() const {
// @@protoc_insertion_point(field_list:google.protobuf.Enum.options)
@@ -2045,7 +2066,8 @@ inline ::google::protobuf::SourceContext* Enum::unsafe_arena_release_source_cont
inline ::google::protobuf::SourceContext* Enum::mutable_source_context() {
if (source_context_ == NULL) {
- _slow_mutable_source_context();
+ source_context_ = ::google::protobuf::Arena::Create< ::google::protobuf::SourceContext >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.Enum.source_context)
return source_context_;
@@ -2183,23 +2205,23 @@ inline int EnumValue::options_size() const {
inline void EnumValue::clear_options() {
options_.Clear();
}
-inline const ::google::protobuf::Option& EnumValue::options(int index) const {
- // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.options)
- return options_.Get(index);
-}
inline ::google::protobuf::Option* EnumValue::mutable_options(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.EnumValue.options)
return options_.Mutable(index);
}
-inline ::google::protobuf::Option* EnumValue::add_options() {
- // @@protoc_insertion_point(field_add:google.protobuf.EnumValue.options)
- return options_.Add();
-}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
EnumValue::mutable_options() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValue.options)
return &options_;
}
+inline const ::google::protobuf::Option& EnumValue::options(int index) const {
+ // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.options)
+ return options_.Get(index);
+}
+inline ::google::protobuf::Option* EnumValue::add_options() {
+ // @@protoc_insertion_point(field_add:google.protobuf.EnumValue.options)
+ return options_.Add();
+}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
EnumValue::options() const {
// @@protoc_insertion_point(field_list:google.protobuf.EnumValue.options)
@@ -2315,7 +2337,8 @@ inline ::google::protobuf::Any* Option::unsafe_arena_release_value() {
inline ::google::protobuf::Any* Option::mutable_value() {
if (value_ == NULL) {
- _slow_mutable_value();
+ value_ = ::google::protobuf::Arena::Create< ::google::protobuf::Any >(
+ GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.Option.value)
return value_;
@@ -2380,4 +2403,4 @@ inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::Syntax>() {
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_google_2fprotobuf_2ftype_2eproto__INCLUDED
+#endif // PROTOBUF_google_2fprotobuf_2ftype_2eproto_INCLUDED
diff --git a/src/google/protobuf/unittest.proto b/src/google/protobuf/unittest.proto
index 45a0edad..2a288daa 100644
--- a/src/google/protobuf/unittest.proto
+++ b/src/google/protobuf/unittest.proto
@@ -189,6 +189,9 @@ message NestedTestAllTypes {
message TestDeprecatedFields {
optional int32 deprecated_int32 = 1 [deprecated=true];
+ oneof oneof_fields {
+ int32 deprecated_int32_in_oneof = 2 [deprecated=true];
+ }
}
message TestDeprecatedMessage {
diff --git a/src/google/protobuf/unittest_import_proto3.proto b/src/google/protobuf/unittest_import_proto3.proto
deleted file mode 100644
index 59673eaf..00000000
--- a/src/google/protobuf/unittest_import_proto3.proto
+++ /dev/null
@@ -1,68 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// 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_proto3.proto to test importing.
-
-syntax = "proto3";
-
-// 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;
-
-option optimize_for = SPEED;
-option cc_enable_arenas = true;
-
-// Exercise the java_package option.
-option java_package = "com.google.protobuf.test";
-option csharp_namespace = "Google.Protobuf.TestProtos";
-
-// Do not set a java_outer_classname here to verify that Proto2 works without
-// one.
-
-// Test public import
-import public "google/protobuf/unittest_import_public_proto3.proto";
-
-message ImportMessage {
- int32 d = 1;
-}
-
-enum ImportEnum {
- IMPORT_ENUM_UNSPECIFIED = 0;
- IMPORT_FOO = 7;
- IMPORT_BAR = 8;
- IMPORT_BAZ = 9;
-}
-
diff --git a/src/google/protobuf/unittest_lite_imports_nonlite.proto b/src/google/protobuf/unittest_lite_imports_nonlite.proto
index 132d6a82..8a470160 100644
--- a/src/google/protobuf/unittest_lite_imports_nonlite.proto
+++ b/src/google/protobuf/unittest_lite_imports_nonlite.proto
@@ -41,4 +41,7 @@ option optimize_for = LITE_RUNTIME;
message TestLiteImportsNonlite {
optional TestAllTypes message = 1;
+
+ // Verifies that transitive required fields generates valid code.
+ optional TestRequired message_with_required = 2;
}
diff --git a/src/google/protobuf/util/field_comparator.cc b/src/google/protobuf/util/field_comparator.cc
index a1a56ee6..86ddf06a 100644
--- a/src/google/protobuf/util/field_comparator.cc
+++ b/src/google/protobuf/util/field_comparator.cc
@@ -36,6 +36,7 @@
#include <google/protobuf/descriptor.h>
#include <google/protobuf/message.h>
+#include <google/protobuf/util/message_differencer.h>
#include <google/protobuf/stubs/map_util.h>
#include <google/protobuf/stubs/mathlimits.h>
#include <google/protobuf/stubs/mathutil.h>
@@ -130,6 +131,15 @@ FieldComparator::ComparisonResult DefaultFieldComparator::Compare(
}
}
+bool DefaultFieldComparator::Compare(
+ MessageDifferencer* differencer,
+ const Message& message1,
+ const Message& message2,
+ const google::protobuf::util::FieldContext* field_context) {
+ return differencer->Compare(
+ message1, message2, field_context->parent_fields());
+}
+
void DefaultFieldComparator::SetDefaultFractionAndMargin(double fraction,
double margin) {
default_tolerance_ = Tolerance(fraction, margin);
diff --git a/src/google/protobuf/util/field_comparator.h b/src/google/protobuf/util/field_comparator.h
index 26a7ba4d..27ef4c77 100644
--- a/src/google/protobuf/util/field_comparator.h
+++ b/src/google/protobuf/util/field_comparator.h
@@ -35,6 +35,7 @@
#include <map>
#include <string>
+#include <vector>
#include <google/protobuf/stubs/common.h>
@@ -48,6 +49,7 @@ class FieldDescriptor;
namespace util {
class FieldContext;
+class MessageDifferencer;
// Base class specifying the interface for comparing protocol buffer fields.
// Regular users should consider using or subclassing DefaultFieldComparator
@@ -153,6 +155,15 @@ class LIBPROTOBUF_EXPORT DefaultFieldComparator : public FieldComparator {
// REQUIRES: float_comparison_ == APPROXIMATE
void SetDefaultFractionAndMargin(double fraction, double margin);
+ protected:
+ // Compare using the provided message_differencer. For example, a subclass can
+ // use this method to compare some field in a certain way using the same
+ // message_differencer instance and the field context.
+ bool Compare(MessageDifferencer* differencer,
+ const google::protobuf::Message& message1,
+ const google::protobuf::Message& message2,
+ const google::protobuf::util::FieldContext* field_context);
+
private:
// Defines the tolerance for floating point comparison (fraction and margin).
struct Tolerance {
diff --git a/src/google/protobuf/util/field_mask_util.h b/src/google/protobuf/util/field_mask_util.h
index 01642c6f..91787bd5 100644
--- a/src/google/protobuf/util/field_mask_util.h
+++ b/src/google/protobuf/util/field_mask_util.h
@@ -94,6 +94,13 @@ class LIBPROTOBUF_EXPORT FieldMaskUtil {
// Creates a FieldMask with all fields of type T. This FieldMask only
// contains fields of T but not any sub-message fields.
template <typename T>
+ static FieldMask GetFieldMaskForAllFields() {
+ FieldMask out;
+ InternalGetFieldMaskForAllFields(T::descriptor(), &out);
+ return out;
+ }
+ template <typename T>
+ PROTOBUF_RUNTIME_DEPRECATED("Use *out = GetFieldMaskForAllFields() instead")
static void GetFieldMaskForAllFields(FieldMask* out) {
InternalGetFieldMaskForAllFields(T::descriptor(), out);
}
@@ -122,6 +129,8 @@ class LIBPROTOBUF_EXPORT FieldMaskUtil {
// Returns true if path is covered by the given FieldMask. Note that path
// "foo.bar" covers all paths like "foo.bar.baz", "foo.bar.quz.x", etc.
+ // Also note that parent paths are not covered by explicit child path, i.e.
+ // "foo.bar" does NOT cover "foo", even if "bar" is the only child.
static bool IsPathInFieldMask(StringPiece path, const FieldMask& mask);
class MergeOptions;
diff --git a/src/google/protobuf/util/field_mask_util_test.cc b/src/google/protobuf/util/field_mask_util_test.cc
index 7939f733..0664d9e5 100644
--- a/src/google/protobuf/util/field_mask_util_test.cc
+++ b/src/google/protobuf/util/field_mask_util_test.cc
@@ -206,12 +206,12 @@ TEST(FieldMaskUtilTest, TestIsValidFieldMask) {
TEST(FieldMaskUtilTest, TestGetFieldMaskForAllFields) {
FieldMask mask;
- FieldMaskUtil::GetFieldMaskForAllFields<TestAllTypes::NestedMessage>(&mask);
+ mask = FieldMaskUtil::GetFieldMaskForAllFields<TestAllTypes::NestedMessage>();
EXPECT_EQ(1, mask.paths_size());
EXPECT_TRUE(FieldMaskUtil::IsPathInFieldMask("bb", mask));
- FieldMaskUtil::GetFieldMaskForAllFields<TestAllTypes>(&mask);
- EXPECT_EQ(76, mask.paths_size());
+ mask = FieldMaskUtil::GetFieldMaskForAllFields<TestAllTypes>();
+ EXPECT_EQ(75, mask.paths_size());
EXPECT_TRUE(FieldMaskUtil::IsPathInFieldMask("optional_int32", mask));
EXPECT_TRUE(FieldMaskUtil::IsPathInFieldMask("optional_int64", mask));
EXPECT_TRUE(FieldMaskUtil::IsPathInFieldMask("optional_uint32", mask));
diff --git a/src/google/protobuf/util/internal/json_escaping.h b/src/google/protobuf/util/internal/json_escaping.h
index 9b8b2afd..5495c57f 100644
--- a/src/google/protobuf/util/internal/json_escaping.h
+++ b/src/google/protobuf/util/internal/json_escaping.h
@@ -28,8 +28,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef NET_PROTO2_UTIL_CONVERTER_STRINGS_JSON_ESCAPING_H_
-#define NET_PROTO2_UTIL_CONVERTER_STRINGS_JSON_ESCAPING_H_
+#ifndef GOOGLE_PROTOBUF_UTIL_INTERNAL__JSON_ESCAPING_H__
+#define GOOGLE_PROTOBUF_UTIL_INTERNAL__JSON_ESCAPING_H__
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/bytestream.h>
@@ -86,6 +86,6 @@ class JsonEscaping {
} // namespace converter
} // namespace util
} // namespace protobuf
-} // namespace google
-#endif // NET_PROTO2_UTIL_CONVERTER_STRINGS_JSON_ESCAPING_H_
+} // namespace google
+#endif // GOOGLE_PROTOBUF_UTIL_INTERNAL__JSON_ESCAPING_H__
diff --git a/src/google/protobuf/util/internal/json_objectwriter.cc b/src/google/protobuf/util/internal/json_objectwriter.cc
index 6e4edd88..a431177a 100644
--- a/src/google/protobuf/util/internal/json_objectwriter.cc
+++ b/src/google/protobuf/util/internal/json_objectwriter.cc
@@ -57,7 +57,7 @@ JsonObjectWriter::~JsonObjectWriter() {
JsonObjectWriter* JsonObjectWriter::StartObject(StringPiece name) {
WritePrefix(name);
WriteChar('{');
- Push();
+ PushObject();
return this;
}
@@ -71,7 +71,7 @@ JsonObjectWriter* JsonObjectWriter::EndObject() {
JsonObjectWriter* JsonObjectWriter::StartList(StringPiece name) {
WritePrefix(name);
WriteChar('[');
- Push();
+ PushArray();
return this;
}
@@ -172,8 +172,7 @@ void JsonObjectWriter::WritePrefix(StringPiece name) {
bool not_first = !element()->is_first();
if (not_first) WriteChar(',');
if (not_first || !element()->is_root()) NewLine();
- bool empty_key_ok = GetAndResetEmptyKeyOk();
- if (!name.empty() || empty_key_ok) {
+ if (!name.empty() || element()->is_json_object()) {
WriteChar('"');
if (!name.empty()) {
ArrayByteSource source(name);
@@ -184,12 +183,6 @@ void JsonObjectWriter::WritePrefix(StringPiece name) {
}
}
-bool JsonObjectWriter::GetAndResetEmptyKeyOk() {
- bool retval = empty_name_ok_for_next_key_;
- empty_name_ok_for_next_key_ = false;
- return retval;
-}
-
} // namespace converter
} // namespace util
} // namespace protobuf
diff --git a/src/google/protobuf/util/internal/json_objectwriter.h b/src/google/protobuf/util/internal/json_objectwriter.h
index 31edc292..81da0500 100644
--- a/src/google/protobuf/util/internal/json_objectwriter.h
+++ b/src/google/protobuf/util/internal/json_objectwriter.h
@@ -89,12 +89,11 @@ class LIBPROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
public:
JsonObjectWriter(StringPiece indent_string,
google::protobuf::io::CodedOutputStream* out)
- : element_(new Element(NULL)),
+ : element_(new Element(/*parent=*/NULL, /*is_json_object=*/false)),
stream_(out),
sink_(out),
indent_string_(indent_string.ToString()),
- use_websafe_base64_for_bytes_(false),
- empty_name_ok_for_next_key_(false) {}
+ use_websafe_base64_for_bytes_(false) {}
virtual ~JsonObjectWriter();
// ObjectWriter methods.
@@ -118,17 +117,13 @@ class LIBPROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
use_websafe_base64_for_bytes_ = value;
}
- // Whether empty strings should be rendered for the next JSON key. This
- // setting is only valid until the next key is rendered, after which it gets
- // reset to false.
- virtual void empty_name_ok_for_next_key() {
- empty_name_ok_for_next_key_ = true;
- }
-
protected:
class LIBPROTOBUF_EXPORT Element : public BaseElement {
public:
- explicit Element(Element* parent) : BaseElement(parent), is_first_(true) {}
+ Element(Element* parent, bool is_json_object)
+ : BaseElement(parent),
+ is_first_(true),
+ is_json_object_(is_json_object) {}
// Called before each field of the Element is to be processed.
// Returns true if this is the first call (processing the first field).
@@ -140,8 +135,13 @@ class LIBPROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
return false;
}
+ // Whether we are currently renderring inside a JSON object (i.e., between
+ // StartObject() and EndObject()).
+ bool is_json_object() const { return is_json_object_; }
+
private:
bool is_first_;
+ bool is_json_object_;
GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS(Element);
};
@@ -175,8 +175,15 @@ class LIBPROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
return this;
}
- // Pushes a new element to the stack.
- void Push() { element_.reset(new Element(element_.release())); }
+ // Pushes a new JSON array element to the stack.
+ void PushArray() {
+ element_.reset(new Element(element_.release(), /*is_json_object=*/false));
+ }
+
+ // Pushes a new JSON object element to the stack.
+ void PushObject() {
+ element_.reset(new Element(element_.release(), /*is_json_object=*/true));
+ }
// Pops an element off of the stack and deletes the popped element.
void Pop() {
@@ -204,10 +211,6 @@ class LIBPROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
// Writes an individual character to the output.
void WriteChar(const char c) { stream_->WriteRaw(&c, sizeof(c)); }
- // Returns the current value of empty_name_ok_for_next_key_ and resets it to
- // false.
- bool GetAndResetEmptyKeyOk();
-
google::protobuf::scoped_ptr<Element> element_;
google::protobuf::io::CodedOutputStream* stream_;
ByteSinkWrapper sink_;
@@ -217,11 +220,6 @@ class LIBPROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
// to regular base64 encoding.
bool use_websafe_base64_for_bytes_;
- // Whether empty strings should be rendered for the next JSON key. This
- // setting is only valid until the next key is rendered, after which it gets
- // reset to false.
- bool empty_name_ok_for_next_key_;
-
GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS(JsonObjectWriter);
};
diff --git a/src/google/protobuf/util/internal/json_objectwriter_test.cc b/src/google/protobuf/util/internal/json_objectwriter_test.cc
index bbd9d78a..8cc588a6 100644
--- a/src/google/protobuf/util/internal/json_objectwriter_test.cc
+++ b/src/google/protobuf/util/internal/json_objectwriter_test.cc
@@ -95,6 +95,12 @@ TEST_F(JsonObjectWriterTest, EmptyList) {
output_.substr(0, out_stream_->ByteCount()));
}
+TEST_F(JsonObjectWriterTest, EmptyObjectKey) {
+ ow_ = new JsonObjectWriter("", out_stream_);
+ ow_->StartObject("")->RenderString("", "value")->EndObject();
+ EXPECT_EQ("{\"\":\"value\"}", output_.substr(0, out_stream_->ByteCount()));
+}
+
TEST_F(JsonObjectWriterTest, ObjectInObject) {
ow_ = new JsonObjectWriter("", out_stream_);
ow_->StartObject("")
diff --git a/src/google/protobuf/util/internal/object_writer.h b/src/google/protobuf/util/internal/object_writer.h
index b6fbd19b..5781aa1e 100644
--- a/src/google/protobuf/util/internal/object_writer.h
+++ b/src/google/protobuf/util/internal/object_writer.h
@@ -119,13 +119,6 @@ class LIBPROTOBUF_EXPORT ObjectWriter {
return use_strict_base64_decoding_;
}
- // Whether empty strings should be rendered for the next name for Start/Render
- // calls. This setting is only valid until the next key is rendered, after
- // which it gets reset.
- // It is up to the derived classes to interpret this and render accordingly.
- // Default implementation ignores this setting.
- virtual void empty_name_ok_for_next_key() {}
-
protected:
ObjectWriter() : use_strict_base64_decoding_(true) {}
diff --git a/src/google/protobuf/util/internal/protostream_objectsource.cc b/src/google/protobuf/util/internal/protostream_objectsource.cc
index 02360a1a..72ad5a7a 100644
--- a/src/google/protobuf/util/internal/protostream_objectsource.cc
+++ b/src/google/protobuf/util/internal/protostream_objectsource.cc
@@ -300,8 +300,6 @@ StatusOr<uint32> ProtoStreamObjectSource::RenderMap(
return Status(util::error::INTERNAL, "Invalid map entry.");
}
ASSIGN_OR_RETURN(map_key, MapKeyDefaultValueAsString(*key_field));
- // Key is empty, force it to render as empty (for string values).
- ow->empty_name_ok_for_next_key();
}
RETURN_IF_ERROR(RenderField(field, map_key, ow));
} else {
diff --git a/src/google/protobuf/util/internal/utility.cc b/src/google/protobuf/util/internal/utility.cc
index 11780ee8..b1007765 100644
--- a/src/google/protobuf/util/internal/utility.cc
+++ b/src/google/protobuf/util/internal/utility.cc
@@ -353,8 +353,6 @@ bool IsMap(const google::protobuf::Field& field,
google::protobuf::Field_Cardinality_CARDINALITY_REPEATED &&
(GetBoolOptionOrDefault(type.options(), "map_entry", false) ||
GetBoolOptionOrDefault(type.options(),
- "google.protobuf.MessageOptions.map_entry", false) ||
- GetBoolOptionOrDefault(type.options(),
"google.protobuf.MessageOptions.map_entry",
false));
}
@@ -362,9 +360,6 @@ bool IsMap(const google::protobuf::Field& field,
bool IsMessageSetWireFormat(const google::protobuf::Type& type) {
return GetBoolOptionOrDefault(type.options(), "message_set_wire_format",
false) ||
- GetBoolOptionOrDefault(type.options(),
- "google.protobuf.MessageOptions.message_set_wire_format",
- false) ||
GetBoolOptionOrDefault(
type.options(),
"google.protobuf.MessageOptions.message_set_wire_format", false);
diff --git a/src/google/protobuf/util/json_util.cc b/src/google/protobuf/util/json_util.cc
index ce3569ce..25e78a65 100644
--- a/src/google/protobuf/util/json_util.cc
+++ b/src/google/protobuf/util/json_util.cc
@@ -50,7 +50,9 @@ namespace util {
namespace internal {
ZeroCopyStreamByteSink::~ZeroCopyStreamByteSink() {
- stream_->BackUp(buffer_size_);
+ if (buffer_size_ > 0) {
+ stream_->BackUp(buffer_size_);
+ }
}
void ZeroCopyStreamByteSink::Append(const char* bytes, size_t len) {
diff --git a/src/google/protobuf/util/json_util.h b/src/google/protobuf/util/json_util.h
index dee3ddba..b1c69813 100644
--- a/src/google/protobuf/util/json_util.h
+++ b/src/google/protobuf/util/json_util.h
@@ -56,10 +56,10 @@ struct JsonPrintOptions {
// Whether to add spaces, line breaks and indentation to make the JSON output
// easy to read.
bool add_whitespace;
- // Whether to always print primitive fields. By default primitive fields with
- // default values will be omitted in JSON joutput. For example, an int32 field
- // set to 0 will be omitted. Set this flag to true will override the default
- // behavior and print primitive fields regardless of their values.
+ // Whether to always print primitive fields. By default proto3 primitive
+ // fields with default values will be omitted in JSON output. For example, an
+ // int32 field set to 0 will be omitted. Set this flag to true will override
+ // the default behavior and print primitive fields regardless of their values.
bool always_print_primitive_fields;
// Whether to always print enums as ints. By default they are rendered as
// strings.
diff --git a/src/google/protobuf/util/json_util_test.cc b/src/google/protobuf/util/json_util_test.cc
index 25c7e96c..5b714bb1 100644
--- a/src/google/protobuf/util/json_util_test.cc
+++ b/src/google/protobuf/util/json_util_test.cc
@@ -40,6 +40,7 @@
#include <google/protobuf/util/json_format_proto3.pb.h>
#include <google/protobuf/util/type_resolver.h>
#include <google/protobuf/util/type_resolver_util.h>
+#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <gtest/gtest.h>
namespace google {
@@ -457,6 +458,29 @@ TEST(ZeroCopyStreamByteSinkTest, TestAllInputOutputPatterns) {
}
}
+TEST_F(JsonUtilTest, TestWrongJsonInput) {
+ using namespace google::protobuf;
+ const char json[] = "{\"unknown_field\":\"some_value\"}";
+ io::ArrayInputStream input_stream(json, strlen(json));
+ char proto_buffer[10000];
+ io::ArrayOutputStream output_stream(proto_buffer, sizeof(proto_buffer));
+ std::string message_type = "type.googleapis.com/proto3.TestMessage";
+ TypeResolver* resolver = NewTypeResolverForDescriptorPool(
+ "type.googleapis.com",
+ DescriptorPool::generated_pool());
+
+ util::Status result_status = util::JsonToBinaryStream(resolver,
+ message_type,
+ &input_stream,
+ &output_stream);
+
+ delete resolver;
+
+ EXPECT_FALSE(result_status.ok());
+ EXPECT_EQ(result_status.error_code(),
+ google::protobuf::util::error::INVALID_ARGUMENT);
+}
+
} // namespace
} // namespace util
} // namespace protobuf
diff --git a/src/google/protobuf/util/message_differencer.cc b/src/google/protobuf/util/message_differencer.cc
index e964e041..c32e941c 100644
--- a/src/google/protobuf/util/message_differencer.cc
+++ b/src/google/protobuf/util/message_differencer.cc
@@ -363,9 +363,6 @@ void MessageDifferencer::TreatAsMapUsingKeyComparator(
const MapKeyComparator* key_comparator) {
GOOGLE_CHECK(field->is_repeated()) << "Field must be repeated: "
<< field->full_name();
- GOOGLE_CHECK_EQ(FieldDescriptor::CPPTYPE_MESSAGE, field->cpp_type())
- << "Field has to be message type. Field name is: "
- << field->full_name();
GOOGLE_CHECK(set_fields_.find(field) == set_fields_.end())
<< "Cannot treat this repeated field as both Map and Set for "
<< "comparison.";
@@ -1751,6 +1748,13 @@ void MessageDifferencer::StreamReporter::ReportUnknownFieldIgnored(
printer_->Print("\n"); // Print for newlines.
}
+MessageDifferencer::MapKeyComparator*
+MessageDifferencer::CreateMultipleFieldsMapKeyComparator(
+ const std::vector<std::vector<const FieldDescriptor*> >& key_field_paths) {
+ return new MultipleFieldsMapKeyComparator(this, key_field_paths);
+}
+
+
} // namespace util
} // namespace protobuf
} // namespace google
diff --git a/src/google/protobuf/util/message_differencer.h b/src/google/protobuf/util/message_differencer.h
index b7d4de00..11d6cc03 100644
--- a/src/google/protobuf/util/message_differencer.h
+++ b/src/google/protobuf/util/message_differencer.h
@@ -64,6 +64,7 @@ class Printer;
namespace util {
+class DefaultFieldComparator;
class FieldContext; // declared below MessageDifferencer
// A basic differencer that can be used to determine
@@ -372,7 +373,7 @@ class LIBPROTOBUF_EXPORT MessageDifferencer {
// repeated fields have different numbers of elements, the
// unpaired elements are reported using ReportAdded() or
// ReportDeleted().
- AS_SET, // Treat all the repeated fields as sets by default.
+ AS_SET, // Treat all the repeated fields as sets.
// See TreatAsSet(), as below.
};
@@ -386,6 +387,11 @@ class LIBPROTOBUF_EXPORT MessageDifferencer {
// the only differences between the compared messages is that some fields
// have been moved, then the comparison returns true.
//
+ // Note that despite the name of this method, this is really
+ // comparison as multisets: if one side of the comparison has a duplicate
+ // in the repeated field but the other side doesn't, this will count as
+ // a mismatch.
+ //
// If the scope of comparison is set to PARTIAL, then in addition to what's
// above, extra values added to repeated fields of the second message will
// not cause the comparison to fail.
@@ -470,6 +476,10 @@ class LIBPROTOBUF_EXPORT MessageDifferencer {
const FieldDescriptor* field,
const MapKeyComparator* key_comparator);
+ // Initiates and returns a new instance of MultipleFieldsMapKeyComparator.
+ MapKeyComparator* CreateMultipleFieldsMapKeyComparator(
+ const std::vector<std::vector<const FieldDescriptor*> >& key_field_paths);
+
// Add a custom ignore criteria that is evaluated in addition to the
// ignored fields added with IgnoreField.
// Takes ownership of ignore_criteria.
@@ -660,6 +670,8 @@ class LIBPROTOBUF_EXPORT MessageDifferencer {
};
private:
+ friend class DefaultFieldComparator;
+
// A MapKeyComparator to be used in TreatAsMapUsingKeyComparator.
// Implementation of this class needs to do field value comparison which
// relies on some private methods of MessageDifferencer. That's why this
diff --git a/src/google/protobuf/wire_format_lite.cc b/src/google/protobuf/wire_format_lite.cc
index cd343b74..1d8cda5a 100644
--- a/src/google/protobuf/wire_format_lite.cc
+++ b/src/google/protobuf/wire_format_lite.cc
@@ -34,9 +34,6 @@
#include <google/protobuf/wire_format_lite_inl.h>
-#ifdef __SSE_4_1__
-#include <immintrin.h>
-#endif
#include <stack>
#include <string>
#include <vector>
@@ -635,12 +632,12 @@ bool WireFormatLite::VerifyUtf8String(const char* data,
return true;
}
-#ifdef __SSE_4_1__
-template<typename T, bool ZigZag, bool SignExtended>
-static size_t VarintSize(
- const T* data, const int n,
- const internal::enable_if<sizeof(T) == 4>::type* = NULL) {
+// this code is deliberately written such that clang makes it into really
+// efficient SSE code.
+template<bool ZigZag, bool SignExtended, typename T>
+static size_t VarintSize(const T* data, const int n) {
#if __cplusplus >= 201103L
+ static_assert(sizeof(T) == 4, "This routine only works for 32 bit integers");
// is_unsigned<T> => !ZigZag
static_assert((std::is_unsigned<T>::value ^ ZigZag) ||
std::is_signed<T>::value,
@@ -649,101 +646,83 @@ static size_t VarintSize(
static_assert((std::is_unsigned<T>::value ^ SignExtended) ||
std::is_signed<T>::value,
"Cannot SignExtended unsigned types");
+ static_assert(!(SignExtended && ZigZag),
+ "Cannot SignExtended and ZigZag on the same type");
#endif
-
- union vus32 {
- uint32 u[4];
- int32 s[4];
- __m128i v;
- };
-
- static const vus32 ones = {{1, 1, 1, 1}};
-
- // CodedOutputStream::VarintSize32SignExtended returns 10 for negative
- // numbers. We can apply the UInt32Size algorithm, and simultaneously logical
- // shift the MSB into the LSB to determine if it is negative.
- static const vus32 fives = {{5, 5, 5, 5}};
-
- // sum is the vectorized-output of calling CodedOutputStream::VarintSize32 on
- // the processed elements.
- //
- // msb_sum is the count of set most-significant bits. When computing the
- // vectorized CodedOutputStream::VarintSize32SignExtended, negative values
- // have the most significant bit set. VarintSize32SignExtended returns 10 and
- // VarintSize32 returns 5. msb_sum allows us to compute:
- // VarintSize32SignExtended = msb_sum * 5 + VarintSize32
- vus32 sum, v, msb_sum;
- sum.v = _mm_setzero_si128();
- msb_sum.v = _mm_setzero_si128();
-
- int rounded = n & ~(3);
- int i;
- for (i = 0; i < rounded; i += 4) {
- v.v = _mm_loadu_si128(reinterpret_cast<const __m128i*>(&data[i]));
-
+ uint32 sum = n;
+ uint32 msb_sum = 0;
+ for (int i = 0; i < n; i++) {
+ uint32 x = data[i];
if (ZigZag) {
- // Note: the right-shift must be arithmetic
- v.v = _mm_xor_si128(_mm_slli_epi32(v.v, 1), _mm_srai_epi32(v.v, 31));
- }
-
- sum.v = _mm_add_epi32(sum.v, ones.v);
- if (SignExtended) {
- msb_sum.v = _mm_add_epi32(msb_sum.v, _mm_srli_epi32(v.v, 31));
- }
-
- v.v = _mm_srli_epi32(v.v, 7);
-
- for (int j = 0; j < 4; j++) {
- __m128i min = _mm_min_epi32(v.v, ones.v);
-
- sum.v = _mm_add_epi32(sum.v, min);
- v.v = _mm_srli_epi32(v.v, 7);
+ x = WireFormatLite::ZigZagEncode32(x);
+ } else if (SignExtended) {
+ msb_sum += x >> 31;
}
+ // clang is so smart that it produces optimal SSE sequence unrolling
+ // the loop 8 ints at a time. With a sequence of 4
+ // cmpres = cmpgt x, sizeclass ( -1 or 0)
+ // sum = sum - cmpres
+ if (x > 0x7F) sum++;
+ if (x > 0x3FFF) sum++;
+ if (x > 0x1FFFFF) sum++;
+ if (x > 0xFFFFFFF) sum++;
}
+ if (SignExtended) sum += msb_sum * 5;
+ return sum;
+}
- if (SignExtended) {
- vus32 extensions;
- extensions.v = _mm_mullo_epi32(msb_sum.v, fives.v);
-
- sum.v = _mm_add_epi32(sum.v, extensions.v);
- }
-
- // TODO(ckennelly): Can we avoid the sign conversion?
- size_t out = _mm_cvtsi128_si32(
- _mm_hadd_epi32(_mm_hadd_epi32(sum.v, ones.v), ones.v));
-
- // Finish tail.
- for (; i < n; i++) {
+template<bool ZigZag, typename T>
+static size_t VarintSize64(const T* data, const int n) {
+#if __cplusplus >= 201103L
+ static_assert(sizeof(T) == 8, "This routine only works for 64 bit integers");
+ // is_unsigned<T> => !ZigZag
+ static_assert(!ZigZag || !std::is_unsigned<T>::value,
+ "Cannot ZigZag encode unsigned types");
+#endif
+ uint64 sum = n;
+ for (int i = 0; i < n; i++) {
+ uint64 x = data[i];
if (ZigZag) {
- out += WireFormatLite::SInt32Size(data[i]);
- } else if (SignExtended) {
- out += WireFormatLite::Int32Size(data[i]);
- } else {
- out += WireFormatLite::UInt32Size(data[i]);
+ x = WireFormatLite::ZigZagEncode64(x);
}
+ // First step is a binary search, we can't branch in sse so we use the
+ // result of the compare to adjust sum and appropriately. This code is
+ // written to make clang recognize the vectorization.
+ uint64 tmp = x >= (static_cast<uint64>(1) << 35) ? -1 : 0;
+ sum += 5 & tmp;
+ x >>= 35 & tmp;
+ if (x > 0x7F) sum++;
+ if (x > 0x3FFF) sum++;
+ if (x > 0x1FFFFF) sum++;
+ if (x > 0xFFFFFFF) sum++;
}
-
- return out;
+ return sum;
}
+// GCC does not recognize the vectorization opportunity
+// and other platforms are untested, in those cases using the optimized
+// varint size routine for each element is faster.
+// Hence we enable it only for clang
+#if defined(__SSE__) && defined(__clang__)
size_t WireFormatLite::Int32Size(const RepeatedField<int32>& value) {
- return VarintSize<int32, false, true>(value.data(), value.size());
+ return VarintSize<false, true>(value.data(), value.size());
}
size_t WireFormatLite::UInt32Size(const RepeatedField<uint32>& value) {
- return VarintSize<uint32, false, false>(value.data(), value.size());
+ return VarintSize<false, false>(value.data(), value.size());
}
size_t WireFormatLite::SInt32Size(const RepeatedField<int32>& value) {
- return VarintSize<int32, true, true>(value.data(), value.size());
+ return VarintSize<true, false>(value.data(), value.size());
}
size_t WireFormatLite::EnumSize(const RepeatedField<int>& value) {
// On ILP64, sizeof(int) == 8, which would require a different template.
- return VarintSize<int, false, true>(value.data(), value.size());
+ return VarintSize<false, true>(value.data(), value.size());
}
-#else // !__SSE_4_1__
+#else // !(defined(__SSE4_1__) && defined(__clang__))
+
size_t WireFormatLite::Int32Size(const RepeatedField<int32>& value) {
size_t out = 0;
const int n = value.size();
@@ -779,6 +758,56 @@ size_t WireFormatLite::EnumSize(const RepeatedField<int>& value) {
}
return out;
}
+
+#endif
+
+// Micro benchmarks show that the SSE improved loop only starts beating
+// the normal loop on Haswell platforms and then only for >32 ints. We
+// disable this for now. Some specialized users might find it worthwhile to
+// enable this.
+#define USE_SSE_FOR_64_BIT_INTEGER_ARRAYS 0
+#if USE_SSE_FOR_64_BIT_INTEGER_ARRAYS
+size_t WireFormatLite::Int64Size (const RepeatedField< int64>& value) {
+ return VarintSize64<false>(value.data(), value.size());
+}
+
+size_t WireFormatLite::UInt64Size(const RepeatedField<uint64>& value) {
+ return VarintSize64<false>(value.data(), value.size());
+}
+
+size_t WireFormatLite::SInt64Size(const RepeatedField< int64>& value) {
+ return VarintSize64<true>(value.data(), value.size());
+}
+
+#else
+
+size_t WireFormatLite::Int64Size (const RepeatedField< int64>& value) {
+ size_t out = 0;
+ const int n = value.size();
+ for (int i = 0; i < n; i++) {
+ out += Int64Size(value.Get(i));
+ }
+ return out;
+}
+
+size_t WireFormatLite::UInt64Size(const RepeatedField<uint64>& value) {
+ size_t out = 0;
+ const int n = value.size();
+ for (int i = 0; i < n; i++) {
+ out += UInt64Size(value.Get(i));
+ }
+ return out;
+}
+
+size_t WireFormatLite::SInt64Size(const RepeatedField< int64>& value) {
+ size_t out = 0;
+ const int n = value.size();
+ for (int i = 0; i < n; i++) {
+ out += SInt64Size(value.Get(i));
+ }
+ return out;
+}
+
#endif
} // namespace internal
diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h
index cf614c02..76275518 100644
--- a/src/google/protobuf/wire_format_lite.h
+++ b/src/google/protobuf/wire_format_lite.h
@@ -674,13 +674,13 @@ class LIBPROTOBUF_EXPORT WireFormatLite {
static inline size_t SInt64Size ( int64 value);
static inline size_t EnumSize ( int value);
- static size_t Int32Size (const RepeatedField< int32>& value);
- static inline size_t Int64Size (const RepeatedField< int64>& value);
- static size_t UInt32Size(const RepeatedField<uint32>& value);
- static inline size_t UInt64Size(const RepeatedField<uint64>& value);
- static size_t SInt32Size(const RepeatedField< int32>& value);
- static inline size_t SInt64Size(const RepeatedField< int64>& value);
- static size_t EnumSize (const RepeatedField< int>& value);
+ static size_t Int32Size (const RepeatedField< int32>& value);
+ static size_t Int64Size (const RepeatedField< int64>& value);
+ static size_t UInt32Size(const RepeatedField<uint32>& value);
+ static size_t UInt64Size(const RepeatedField<uint64>& value);
+ static size_t SInt32Size(const RepeatedField< int32>& value);
+ static size_t SInt64Size(const RepeatedField< int64>& value);
+ static size_t EnumSize (const RepeatedField< int>& value);
// These types always have the same size.
static const size_t kFixed32Size = 4;
@@ -860,7 +860,7 @@ inline uint32 WireFormatLite::ZigZagEncode32(int32 n) {
inline int32 WireFormatLite::ZigZagDecode32(uint32 n) {
// Note: Using unsigned types prevent undefined behavior
- return static_cast<int32>((n >> 1) ^ -(n & 1));
+ return static_cast<int32>((n >> 1) ^ (~(n & 1) + 1));
}
inline uint64 WireFormatLite::ZigZagEncode64(int64 n) {
@@ -871,7 +871,7 @@ inline uint64 WireFormatLite::ZigZagEncode64(int64 n) {
inline int64 WireFormatLite::ZigZagDecode64(uint64 n) {
// Note: Using unsigned types prevent undefined behavior
- return static_cast<int64>((n >> 1) ^ -(n & 1));
+ return static_cast<int64>((n >> 1) ^ (~(n & 1) + 1));
}
// String is for UTF-8 text only, but, even so, ReadString() can simply
diff --git a/src/google/protobuf/wire_format_lite_inl.h b/src/google/protobuf/wire_format_lite_inl.h
index b264bd7e..82fb62ae 100644
--- a/src/google/protobuf/wire_format_lite_inl.h
+++ b/src/google/protobuf/wire_format_lite_inl.h
@@ -1043,33 +1043,6 @@ inline size_t WireFormatLite::LengthDelimitedSize(size_t length) {
static_cast<uint32>(length));
}
-size_t WireFormatLite::Int64Size (const RepeatedField< int64>& value) {
- size_t out = 0;
- const int n = value.size();
- for (int i = 0; i < n; i++) {
- out += Int64Size(value.Get(i));
- }
- return out;
-}
-
-size_t WireFormatLite::UInt64Size(const RepeatedField<uint64>& value) {
- size_t out = 0;
- const int n = value.size();
- for (int i = 0; i < n; i++) {
- out += UInt64Size(value.Get(i));
- }
- return out;
-}
-
-size_t WireFormatLite::SInt64Size(const RepeatedField< int64>& value) {
- size_t out = 0;
- const int n = value.size();
- for (int i = 0; i < n; i++) {
- out += SInt64Size(value.Get(i));
- }
- return out;
-}
-
} // namespace internal
} // namespace protobuf
diff --git a/src/google/protobuf/wire_format_unittest.cc b/src/google/protobuf/wire_format_unittest.cc
index cafe9a48..736a1282 100644
--- a/src/google/protobuf/wire_format_unittest.cc
+++ b/src/google/protobuf/wire_format_unittest.cc
@@ -1436,6 +1436,7 @@ TEST(RepeatedVarint, Enum) {
EXPECT_EQ(expected, WireFormatLite::EnumSize(v));
}
+
} // namespace
} // namespace internal
} // namespace protobuf
diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc
index 00e01256..34c6fed1 100644
--- a/src/google/protobuf/wrappers.pb.cc
+++ b/src/google/protobuf/wrappers.pb.cc
@@ -463,9 +463,6 @@ const DoubleValue& DoubleValue::default_instance() {
return *internal_default_instance();
}
-DoubleValue* DoubleValue::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<DoubleValue>(arena);
-}
void DoubleValue::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.DoubleValue)
@@ -725,9 +722,6 @@ const FloatValue& FloatValue::default_instance() {
return *internal_default_instance();
}
-FloatValue* FloatValue::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<FloatValue>(arena);
-}
void FloatValue::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.FloatValue)
@@ -987,9 +981,6 @@ const Int64Value& Int64Value::default_instance() {
return *internal_default_instance();
}
-Int64Value* Int64Value::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<Int64Value>(arena);
-}
void Int64Value::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Int64Value)
@@ -1251,9 +1242,6 @@ const UInt64Value& UInt64Value::default_instance() {
return *internal_default_instance();
}
-UInt64Value* UInt64Value::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<UInt64Value>(arena);
-}
void UInt64Value::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.UInt64Value)
@@ -1515,9 +1503,6 @@ const Int32Value& Int32Value::default_instance() {
return *internal_default_instance();
}
-Int32Value* Int32Value::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<Int32Value>(arena);
-}
void Int32Value::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.Int32Value)
@@ -1779,9 +1764,6 @@ const UInt32Value& UInt32Value::default_instance() {
return *internal_default_instance();
}
-UInt32Value* UInt32Value::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<UInt32Value>(arena);
-}
void UInt32Value::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.UInt32Value)
@@ -2043,9 +2025,6 @@ const BoolValue& BoolValue::default_instance() {
return *internal_default_instance();
}
-BoolValue* BoolValue::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<BoolValue>(arena);
-}
void BoolValue::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.BoolValue)
@@ -2310,9 +2289,6 @@ const StringValue& StringValue::default_instance() {
return *internal_default_instance();
}
-StringValue* StringValue::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<StringValue>(arena);
-}
void StringValue::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.StringValue)
@@ -2592,9 +2568,6 @@ const BytesValue& BytesValue::default_instance() {
return *internal_default_instance();
}
-BytesValue* BytesValue::New(::google::protobuf::Arena* arena) const {
- return ::google::protobuf::Arena::CreateMessage<BytesValue>(arena);
-}
void BytesValue::Clear() {
// @@protoc_insertion_point(message_clear_start:google.protobuf.BytesValue)
@@ -2792,5 +2765,36 @@ void BytesValue::InternalSwap(BytesValue* other) {
// @@protoc_insertion_point(namespace_scope)
} // namespace protobuf
} // namespace google
+namespace google {
+namespace protobuf {
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::DoubleValue* Arena::CreateMessage< ::google::protobuf::DoubleValue >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::DoubleValue >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::FloatValue* Arena::CreateMessage< ::google::protobuf::FloatValue >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::FloatValue >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Int64Value* Arena::CreateMessage< ::google::protobuf::Int64Value >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::Int64Value >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::UInt64Value* Arena::CreateMessage< ::google::protobuf::UInt64Value >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::UInt64Value >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Int32Value* Arena::CreateMessage< ::google::protobuf::Int32Value >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::Int32Value >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::UInt32Value* Arena::CreateMessage< ::google::protobuf::UInt32Value >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::UInt32Value >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::BoolValue* Arena::CreateMessage< ::google::protobuf::BoolValue >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::BoolValue >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::StringValue* Arena::CreateMessage< ::google::protobuf::StringValue >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::StringValue >(arena);
+}
+template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::BytesValue* Arena::CreateMessage< ::google::protobuf::BytesValue >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::google::protobuf::BytesValue >(arena);
+}
+} // namespace protobuf
+} // namespace google
// @@protoc_insertion_point(global_scope)
diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h
index a2f10c8b..876bf39b 100644
--- a/src/google/protobuf/wrappers.pb.h
+++ b/src/google/protobuf/wrappers.pb.h
@@ -1,8 +1,8 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/wrappers.proto
-#ifndef PROTOBUF_google_2fprotobuf_2fwrappers_2eproto__INCLUDED
-#define PROTOBUF_google_2fprotobuf_2fwrappers_2eproto__INCLUDED
+#ifndef PROTOBUF_google_2fprotobuf_2fwrappers_2eproto_INCLUDED
+#define PROTOBUF_google_2fprotobuf_2fwrappers_2eproto_INCLUDED
#include <string>
@@ -105,6 +105,19 @@ LIBPROTOBUF_EXPORT extern UInt64ValueDefaultTypeInternal _UInt64Value_default_in
} // namespace google
namespace google {
namespace protobuf {
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::BoolValue* Arena::CreateMessage< ::google::protobuf::BoolValue>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::BytesValue* Arena::CreateMessage< ::google::protobuf::BytesValue>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::DoubleValue* Arena::CreateMessage< ::google::protobuf::DoubleValue>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::FloatValue* Arena::CreateMessage< ::google::protobuf::FloatValue>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Int32Value* Arena::CreateMessage< ::google::protobuf::Int32Value>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::Int64Value* Arena::CreateMessage< ::google::protobuf::Int64Value>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::StringValue* Arena::CreateMessage< ::google::protobuf::StringValue>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::UInt32Value* Arena::CreateMessage< ::google::protobuf::UInt32Value>(Arena*);
+template<> LIBPROTOBUF_EXPORT ::google::protobuf::UInt64Value* Arena::CreateMessage< ::google::protobuf::UInt64Value>(Arena*);
+} // namespace protobuf
+} // namespace google
+namespace google {
+namespace protobuf {
// ===================================================================
@@ -159,9 +172,13 @@ class LIBPROTOBUF_EXPORT DoubleValue : public ::google::protobuf::Message /* @@p
// implements Message ----------------------------------------------
- inline DoubleValue* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline DoubleValue* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<DoubleValue>(NULL);
+ }
- DoubleValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ DoubleValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<DoubleValue>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const DoubleValue& from);
@@ -273,9 +290,13 @@ class LIBPROTOBUF_EXPORT FloatValue : public ::google::protobuf::Message /* @@pr
// implements Message ----------------------------------------------
- inline FloatValue* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline FloatValue* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<FloatValue>(NULL);
+ }
- FloatValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ FloatValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<FloatValue>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const FloatValue& from);
@@ -387,9 +408,13 @@ class LIBPROTOBUF_EXPORT Int64Value : public ::google::protobuf::Message /* @@pr
// implements Message ----------------------------------------------
- inline Int64Value* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Int64Value* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Int64Value>(NULL);
+ }
- Int64Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Int64Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Int64Value>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Int64Value& from);
@@ -501,9 +526,13 @@ class LIBPROTOBUF_EXPORT UInt64Value : public ::google::protobuf::Message /* @@p
// implements Message ----------------------------------------------
- inline UInt64Value* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline UInt64Value* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<UInt64Value>(NULL);
+ }
- UInt64Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ UInt64Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<UInt64Value>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const UInt64Value& from);
@@ -615,9 +644,13 @@ class LIBPROTOBUF_EXPORT Int32Value : public ::google::protobuf::Message /* @@pr
// implements Message ----------------------------------------------
- inline Int32Value* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline Int32Value* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Int32Value>(NULL);
+ }
- Int32Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ Int32Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<Int32Value>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const Int32Value& from);
@@ -729,9 +762,13 @@ class LIBPROTOBUF_EXPORT UInt32Value : public ::google::protobuf::Message /* @@p
// implements Message ----------------------------------------------
- inline UInt32Value* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline UInt32Value* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<UInt32Value>(NULL);
+ }
- UInt32Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ UInt32Value* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<UInt32Value>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const UInt32Value& from);
@@ -843,9 +880,13 @@ class LIBPROTOBUF_EXPORT BoolValue : public ::google::protobuf::Message /* @@pro
// implements Message ----------------------------------------------
- inline BoolValue* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline BoolValue* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<BoolValue>(NULL);
+ }
- BoolValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ BoolValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<BoolValue>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const BoolValue& from);
@@ -957,9 +998,13 @@ class LIBPROTOBUF_EXPORT StringValue : public ::google::protobuf::Message /* @@p
// implements Message ----------------------------------------------
- inline StringValue* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline StringValue* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<StringValue>(NULL);
+ }
- StringValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ StringValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<StringValue>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const StringValue& from);
@@ -1088,9 +1133,13 @@ class LIBPROTOBUF_EXPORT BytesValue : public ::google::protobuf::Message /* @@pr
// implements Message ----------------------------------------------
- inline BytesValue* New() const PROTOBUF_FINAL { return New(NULL); }
+ inline BytesValue* New() const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<BytesValue>(NULL);
+ }
- BytesValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
+ BytesValue* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL {
+ return ::google::protobuf::Arena::CreateMessage<BytesValue>(arena);
+ }
void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
void CopyFrom(const BytesValue& from);
@@ -1484,4 +1533,4 @@ inline void BytesValue::unsafe_arena_set_allocated_value(
// @@protoc_insertion_point(global_scope)
-#endif // PROTOBUF_google_2fprotobuf_2fwrappers_2eproto__INCLUDED
+#endif // PROTOBUF_google_2fprotobuf_2fwrappers_2eproto_INCLUDED
diff --git a/tests.sh b/tests.sh
index 6733e835..0a91e4ce 100755
--- a/tests.sh
+++ b/tests.sh
@@ -47,7 +47,7 @@ build_cpp() {
git submodule init
git submodule update
cd third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make && cd ../..
- cd benchmarks && make && ./generate-datasets && cd ..
+ cd benchmarks && make cpp-benchmark && cd ..
else
echo ""
echo "WARNING: Skipping validation of the bench marking code, cmake isn't installed."
@@ -87,9 +87,7 @@ build_cpp_distcheck() {
}
build_csharp() {
- # Just for the conformance tests. We don't currently
- # need to really build protoc, but it's simplest to keep with the
- # conventions of the other builds.
+ # Required for conformance tests and to regenerate protos.
internal_build_cpp
NUGET=/usr/local/bin/nuget.exe
@@ -104,6 +102,10 @@ build_csharp() {
(cd dotnettmp; dotnet new > /dev/null)
rm -rf dotnettmp
+ # Check that the protos haven't broken C# codegen.
+ # TODO(jonskeet): Fail if regenerating creates any changes.
+ csharp/generate_protos.sh
+
csharp/buildall.sh
cd conformance && make test_csharp && cd ..